- Home
·
- Miscellaneous
·
- Determine if a year is a leap year by checking if it is a valid date on the system. This assumes yo
Determine if a year is a leap year by checking if it is a valid date on the system. This assumes yo
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.
Rate Determine if a year is a leap year by checking if it is a valid date on the system. This assumes yo
(2(2 Vote))
' 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
Determine if a year is a leap year by checking if it is a valid date on the system. This assumes yo Comments
No comments yet — be the first to post one!
Post a Comment