dbWriter Function to find last day of Month ASP code
Find the last day of the month, including leap years:
<%
Function LastDay(MyMonth, MyYear)
' Returns the last day of the month. Takes into account leap
years
' Usage: LastDay(Month, Year)
' Example: LastDay(12,2000) or LastDay(12)
Select Case MyMonth
Case 1, 3, 5, 7, 8, 10, 12
LastDay = 31
Case 4, 6, 9, 11
LastDay = 30
Case 2
If IsDate(MyYear & "-" & MyMonth & "-" & "29") Then LastDay = 29
Else LastDay = 28
Case Else
LastDay = 0
End Select
End Function
%> |
|