声明一个date类型的变量
dim a as date
a=day

解决方案 »

  1.   

    用isdate(date), 判断date是否合法的日期
      

  2.   

    下面这段代码可以判断出指定年月的天数包括2月,应该是最简单的一种方法了    Dim hYear As Integer, hMonth As Integer
        hYear = 2002
        hMonth = 2
        Select Case Day(DateSerial(hYear, hMonth, 31))
            Case 1
                MsgBox "本月30天"
            Case 31
                MsgBox "本月31天"
            Case Else
                MsgBox "现在是2月" & vbCr & "这个2月有:" & IIf(Day(DateSerial(hYear, 2, 29)) = 1, 28, 29) & "天"
        End Select