日期函数扩展类Ver0.1.1(2)
Public Property Let firstweekofyear(value)
firstweekofyear_ = cInt(value)
End Property
'属性 FirstDayofWeek 每周的第一天(详细设置请参照VBS手册)
Public Property Let firstdayofweek(value)
firstdayofweek_ = cInt(value)
End Property
'------------------------------
' 功能说明:算第几周的星期几是几号
' 参数说明:y 年,w周,week 星期 (星期一1 星期天7)
'------------------------------
Public Function GetWeekDate(y, w, DayofWeek)
Dim NewYearDay
NewYearDay = CDate(y & "-1-1") '元旦
GetWeekDate = ((NewYearDay - Weekday(NewYearDay, firstdayofweek_)) + (w - 1) * 7 + DayofWeek)
End Function
'------------------------------
' 功能说明:获得某年某月的天数
'------------------------------
Public Function GetMonthDayCount()
GetMonthDayCount = DateDiff("d", d_, DateAdd("m", 1, d_))
End Function
'------------------------------
' 功能说明:得到某年某月的第一天
'------------------------------
Public Function GetMonthFirstDay()
GetMonthFirstDay = CDate( Year(d_) & "-" & Month(d_) & "-1")
End Function
'------------------------------
' 功能说明:得到某年的某月的最后一天
'------------------------------
Public Function GetMonthLastDay()
GetMonthLastDay = CDate( Year(d_) & "-"&Month(d_) & "-" & DateDiff("d", d_, DateAdd("m", 1, d_)))
End Function
'------------------------------
' 功能说明:某日所在的周的第一天的日期
'------------------------------
内容版权声明:除非注明,否则皆为本站原创文章。