能被四整除的是闰年,如2004
但能被100整除的又不是闰年,如2100年
再能被400整除的又算是闰年,如2000或1600年
一句话:四年一闰,百年不闰,四百年又闰
闰年一年366天,其中二月29天,而非闰年即平年二月28天
其余月份,大月31天,小月30天.其中大月1,3,5,7,8,10,12
小月4,6,9,11
判断月份标准不同,有很多种.公认的有以春345,夏678秋9,10,11冬12,1,2为标准以有其它
Private Sub Command1_Click()
Dim t, i As String
'判断是否闰年
If Year(Date) Mod 4 = 0 Then
If Year(Date) Mod 100 <> 0 Then
t = "闰年"
ElseIf Year(Date) Mod 400 = 0 Then
t = "闰年"
Else
t = "平年"
End If
Else
t = "平年"
End If
'将闰年和平年的结果储存
If t = "闰年" Then i = 1 Else i = 0
'判断季节,按照国际惯例划分
If Month(Date) <= 3 Then
t = t & "春季"
ElseIf Month(Date) <= 6 Then
t = t & "夏季"
ElseIf Month(Date) <= 9 Then
t = t & "秋季"
ElseIf Month(Date) <= 12 Then
t = t & "冬季"
End If
'判断每月的天数
If Month(Date) = 1 Or Month(Date) = 3 Or Month(Date) = 5 Or Month(Date) = 7 Or Month(Date) = 8 Or Month(Date) = 10 Or Month(Date) = 12 Then
t = t & ",这个月有31天。"
ElseIf Month(Date) = 2 Then
If i = 1 Then t = t & ",这个月有29天。" Else t = t & ",这个月有28天。"
Else
t = t & ",这个月有30天。"
End If
Print t
End Sub