A Q

Function IsLeap(sYear As String) As Integer 
If IsDate("02/29/" & sYear) Then 
IsLeap = True 
Else 
IsLeap = False 
End If 
End Function 
书上有的

解决方案 »

  1.   

    不是吧,这个算法在学c语言的时候,是书上的例子啊!
    Function IsLeapYear(ByVal yr As Integer) As Boolean
    If ((yr Mod 4) = 0) Then 
    IsLeapYear = ((yr Mod 100) > 0) Or ((yr Mod 400) = 0)
    End If
    End Function
      

  2.   

    Function IsLeap(sYear As long) As Boolean
    If (syear mod 4=0 and syear mod 100<>0) or (syear mod 400=0) Then 
    IsLeap = True 
    Else 
    IsLeap = False 
    End If 
    End Function 
      

  3.   

    = (year and 3)=0 and Not year\100=0 Or year\400=0