Option Explicit
Private Sub Command1_Click()
Print 2000
Print IsLeapYearA(2000)
Print IsLeapYearB(2000)
Print 1999
Print IsLeapYearA(1999)
Print IsLeapYearB(1999)
Print 1998
Print IsLeapYearA(1998)
Print IsLeapYearB(1998)
Print 1997
Print IsLeapYearA(1997)
Print IsLeapYearB(1997)
Print 1996
Print IsLeapYearA(1996)
Print IsLeapYearB(1996)
End Sub
Function IsLeapYearA(ByVal yr As Integer) As Boolean
If ((yr Mod 4) = 0) Then IsLeapYearA = ((yr Mod 100) > 0) Or ((yr Mod 400) = 0)
End If
End Function
Public Function IsLeapYearB(ByVal yr As Integer) As Boolean
IsLeapYearB = Day(DateSerial(yr, 2, 29)) = 29
End Function
文章来源于领测软件测试网 https://www.ltesting.net/
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073