GetDaysInMonth Function:
How many days in a given month
Description:
GetDaysInMonth Function returns how many days there are in a given month.
Syntax:
int = GetDaysInMonth(Month, Year)
Example:
<%
response.write GetDaysInMonth("2", "2004") '--- returns: 29
%>
ASP Source Code:
<%
Function GetDaysInMonth(strMonth, strYear) Dim strDays Select Case cint(strMonth) Case 1, 3, 5, 7, 8, 10, 12: strDays = 31 Case 4, 6, 9, 11: strDays = 30 Case 2: if ((cint(strYear) mod 4 = 0 and cint(strYear) mod 100 <> 0) or ( cint(strYear) mod 400 = 0) ) then strDays = 29 else strDays = 28 end if End Select GetDaysInMonth = strDays End Function
%>
|