DaysInMonth

Syntax:

DaysInMonth(dateexpr)

Description:
Returns the number of days in the month of the date specified.

Parameter Description

dateexpr A valid time type or variant that can be converted to a date value

Example:

Sub Main
'display the number of days in the current month
  numberofdaysthismonth = DaysInMonth(Now())

  'display the number of days in next month
  numberofdaysnextmonth = DaysInMonth(DateAdd("m",1, Now()))

  'display the number of days in month of a custom date
  numberofdayscustommonth = DaysInMonth(DateSerial(2004,02,34))

End
Sub

 

See Also:

DaysInYear