以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  如何计算时间段内的有几个周六  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=142753)

--  作者:baoxyang
--  发布时间:2019/11/5 13:29:00
--  如何计算时间段内的有几个周六
请教,如何计算时间段内的有几个周六,谢谢!!
--  作者:有点蓝
--  发布时间:2019/11/5 14:35:00
--  
Dim d1 As Date = #09/28/2019#
Dim d2 As Date = #11/02/2019#
Dim w As Integer = d1.DayOfWeek
Dim tp As TimeSpan = d2-d1
Dim ta As Integer = Math.Ceiling(tp.TotalDays)+1
Dim cnt As Integer = Math.Floor((ta-(6-w))/7)
Output.Show(cnt)