Function LongYear(Y) As Boolean "已知年返回是否潤年
If (Y Mod 4 = 0 Or Y Mod 400 = 0) And Y Mod 100 0 Then
LongYear=True
Else
LongYear=False
End If
End Function
Function MonthDayCount(Y,M) "已知年月返回月天數
Select Case Month
Case 4,6,9,11
MonthDayCount=30
Case 2
MonthDayCount=IIF(LongYear(Y)=True,29,28)
Case Else
MonthDayCount=31
End Select
Function Season(M)"已知月返回季節
Case 3,4,5
Season="春"
Case 6,7,8
Season="夏"
Case 9,10,11
Season="秋"
Reason="冬"
Function LongYear(Y) As Boolean "已知年返回是否潤年
If (Y Mod 4 = 0 Or Y Mod 400 = 0) And Y Mod 100 0 Then
LongYear=True
Else
LongYear=False
End If
End Function
Function MonthDayCount(Y,M) "已知年月返回月天數
Select Case Month
Case 4,6,9,11
MonthDayCount=30
Case 2
MonthDayCount=IIF(LongYear(Y)=True,29,28)
Case Else
MonthDayCount=31
End Select
End Function
Function Season(M)"已知月返回季節
Select Case Month
Case 3,4,5
Season="春"
Case 6,7,8
Season="夏"
Case 9,10,11
Season="秋"
Case Else
Reason="冬"
End Select
End Function