Test if year is LeapYear

 
Function IsLeapYear(yr As Integer) As Boolean
'Note: to test if date is in Leapyear simply call
'	IsLeapYear(Year(dat))
'Testcases:
'Testting is done by comparing the result of a date manipulation method to obtain LeapYear
'with the implemented algorithm (which reflects the formal test for leapyear
'?(IsLeapYear(2004) = (Day(DateAdd("d", 1, #2/28/2004#)) = 29)) >> True
'?(IsLeapYear(2003) = (Day(DateAdd("d", 1, #2/28/2003#)) = 29)) >> True
'?(IsLeapYear(2000) = (Day(DateAdd("d", 1, #2/28/2000#)) = 29)) >> True
'?(IsLeapYear(1000) = (Day(DateAdd("d", 1, #2/28/1000#)) = 29)) >> True
    IsLeapYear = ((yr Mod 4 = 0) And (yr Mod 100 <> 0)) Or (yr Mod 400 = 0)
End Function