'------------使用示例--------------
'Print MonthDays(#1/1/2002#)
'31
'Print MonthDays(#2/1/2002#)
'28
'Print MonthDays(#3/1/2002#)
'31
'----------------------------------
Public Function MonthDays(strday As Date) As Integer '取得月份中的天数函数
Dim MonthfristDay, nextMonthfristDay As Date
MonthfristDay = DateAdd("d", -Day(strday) + 1, strday) '当月第一天
nextMonthfristDay = DateAdd("M", 1, DateAdd("d", -Day(strday) + 1, strday)) '下月第一天
MonthDays = DateDiff("d", MonthfristDay, nextMonthfristDay)
End Function
[此贴子已经被huanghai于2002-7-11 10:35:18编辑过]
|