getDaysInMonth

Gets number of days in a certain month

Function getDaysInMonth(strMonth, strYear)
 Dim strDays 
 strDays = 31 ' Assuming month is 1,3,5,7,8,10,12
 Select Case cint(strMonth)
 Case 4,6,9,11 ' if not
  strDays = 30
 Case 2
  strDays = 28
  if ( (cint(strYear) mod 4 = 0 and cint(strYear) mod 100 <> 0) or ( cint(strYear) mod 400 = 0) ) Then strDays = 29
 End Select
 getDaysInMonth = strDays
End Function

Parameters

strMonth, strYear

Views 151 Downloads 65

Perm link