by Aqeel Ahmed (Aroog Siddiqui) (1 Submission)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 27th July 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Find the last day of the Month using the IsDate function.
' mail me for more code [email protected]
' for calling please note that lined
' Call Funcation like this ---> maxDate("06","2002")
Public Function maxDate(InputMonth As Variant, InputYear As Variant)
chkdate = ("29-" & InputMonth & "-" + InputYear)
If Not IsDate(chkdate) Then
maxDate = 28
Exit Function
End If
chkdate = ("30-" & InputMonth & "-" + InputYear)
If Not IsDate(chkdate) Then
maxDate = 29
Exit Function
End If
chkdate = ("31-" & InputMonth & "-" + InputYear)
If Not IsDate(chkdate) Then
maxDate = 30
Else
maxDate = 31
End If
End Function