by Anonymous (267 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Fri 2nd April 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Determine if a year is a leap year by checking if it is a valid date on the system. This assumes your system is Y2K compliant.
' yr is either a date or an integer
' rely on Windows DateSerial function
Public Function IsLeapYear(yr As Variant) As Boolean
If VarType(yr) = vbDate Then
IsLeapYear = (Day(DateSerial(Year(yr), 2, 29)) = 29)
Else
IsLeapYear = (Day(DateSerial(yr, 2, 29)) = 29)
End If
End Function
No comments have been posted about Determine if a year is a leap year by checking if it is a valid date on the system. This assumes yo. Why not be the first to post a comment about Determine if a year is a leap year by checking if it is a valid date on the system. This assumes yo.