Office中国论坛/Access中国论坛
标题:
[源码] 月初,月末,本月天数的函数
[打印本页]
作者:
huanghai
时间:
2003-9-30 17:59
标题:
[源码] 月初,月末,本月天数的函数
'? firstDayOfMonth("2003-2-4")
' 2003-2-1
'? lastDayOfMonth("2003-2-4")
' 2003-2-28
'? DaysInMonth("2003-2-4")
' 28
Function firstDayOfMonth(myDate As Date) As Date
firstDayOfMonth = CDate(Format(myDate, "yyyy-m-1"))
End Function
Function lastDayOfMonth(myDate As Date) As Date
lastDayOfMonth = DateAdd("d", -1, DateAdd("M", 1, firstDayOfMonth(myDate)))
End Function
Function DaysInMonth(myDate As Date) As Integer
DaysInMonth = DateDiff("d", firstDayOfMonth(myDate), lastDayOfMonth(myDate)) + 1
End Function
作者:
chenghai
时间:
2003-9-30 18:33
谢谢黄大师为我们送来简洁实用的源代码!
作者:
keecome
时间:
2003-10-1 01:38
标题:
[源码] 月初,月末,本月天数的函数
终于找到了,
建议版主把这种实用的贴子放到精华贴里,这样更方便
作者:
pdrich
时间:
2008-9-2 12:44
支持啊
作者:
086-china
时间:
2008-9-2 14:45
支持啊
作者:
chaojianan
时间:
2009-11-7 10:44
支持收藏了。
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3