Teedee Access VBA Teedee 2010
Days in Month
Home Tutorial Code Snippets

Days in Month

Returns the number of days in a month. Accepts a Date or, if no date supplied, defaults to current date.



Code Snippet

Function DaysInMonth(Optional dteInput As Date) As Integer     ' Calculate the number of days in the month for the date that is (optionally) passed to the function.     'If no date is passed, use current date instead.     If dteInput = 0 Then         dteInput = Date     End If     DaysInMonth = Day(DateSerial(Year(dteInput), Month(dteInput) + 1, 0)) End Function