日期:2014-05-17  浏览次数:20800 次

求一个月时间
用什么代码可以得到.每一个月的最后一天.
就像
2月.就28天.
8月.31


------解决方案--------------------
Function GetDaysInMonth(ByVal iMonth As Integer, ByVal iYear As Integer) As Integer
Select Case iMonth
Case 1, 3, 5, 7, 8, 10, 12
GetDaysInMonth = 31
Case 4, 6, 9, 11
GetDaysInMonth = 30
Case 2
If IsDate( "February 29, " & iYear) Then
GetDaysInMonth = 29
Else
GetDaysInMonth = 28
End If
End Select
End Function