Private Function GetMaxDay(intYear As Integer, intMonth As Integer) As Integer Select Case intMonth Case 1, 3, 5, 7, 8, 10, 12 GetMaxDay = 31 Case 2 If intYear Mod 100 = 0 Then If intYear Mod 400 = 0 Then GetMaxDay = 29 Else GetMaxDay = 28 End If Else If intYear Mod 4 = 0 Then GetMaxDay = 29 Else GetMaxDay = 28 End If End If Case 4, 6, 9, 11 GetMaxDay = 30 Case Else GetMaxDay = 30 End Select End Function
Select Case intMonth
Case 1, 3, 5, 7, 8, 10, 12
GetMaxDay = 31
Case 2
If intYear Mod 100 = 0 Then
If intYear Mod 400 = 0 Then
GetMaxDay = 29
Else
GetMaxDay = 28
End If
Else
If intYear Mod 4 = 0 Then
GetMaxDay = 29
Else
GetMaxDay = 28
End If
End If
Case 4, 6, 9, 11
GetMaxDay = 30
Case Else
GetMaxDay = 30
End Select
End Function
感谢!