< Public Function IsLeapYear (TestYear, Optional CalendarType As String = "Gregorian") As Boolean (?)

Comments

'------------------------------------------------------------------ 'Function to test if a year is a leap year '------------------------------------------------------------------

Public Function IsLeapYear (TestYear, Optional CalendarType As String = "Gregorian") As Boolean

    
        
    Select Case LCase(CalendarType)
    
        Case "gregorian":
            'Gregory's (Clavius') fix to the 11-minute error
            If Remainder(TestYear, 400) = 0 Then
                IsLeapYear = True
                
            'Gregory's (Clavius') fix to the 11-minute error
            ElseIf Remainder(TestYear, 100) = 0 Then
                IsLeapYear = False
                
            'Julian's fix to the 6-second error
            ElseIf Remainder(TestYear, 4) = 0 Then
                IsLeapYear = True
                    
            '365-day calendat
            Else
                IsLeapYear = False
                
            End If
            
        Case Else:
    End Select
End Function


Copying, Return to index