如何得到本月一共有多少天?

解决方案 »

  1.   

    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
      

  2.   

    由于小弟水平有限,烦大哥举个例子,如:avr=(a+b)/getmaxday 如何应用。
    感谢!