GetDaysInMonth
'This function will use the computers clock to retrive the days in any month, including leap years. 'If you use this code then please leave your comments or even vote if you have time..
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
'Please dont remove this TAG
'By CoderUX 31-10-2002
'Copy this code into your form or module
Public Function GetDaysInMonth(ByVal ValMonth As Double, Optional ByVal ValYear As Double) as double
On Error GoTo Handler:
If ValYear = Empty Then
GetDaysInMonth = DateDiff("D", "01/" & ValMonth & "/" & Format(Now, "YYYY"), DateAdd("M", 1, "01/" & ValMonth & "/" & Format(Now, "YYYY")))
Else
GetDaysInMonth = DateDiff("D", "01/" & ValMonth & "/" & ValYear, DateAdd("M", 1, "01/" & ValMonth & "/" & ValYear))
End If
Handler:
Exit Function
End Function
Original Comments (3)
Recovered from Wayback Machine