if isdate(str) then if formatdatetime(cdate(str),vblongdate)=formatdatetime(now(),vblongdate) then msgbox "是当前日期" else msgbox "不是当前日期" end if else msgbox "不是合法的日期字符串" end if
Private Sub Command1_Click() Dim str As String str = "2003-3-27" If str = Date Then Debug.Print "a" End If End Sub
if isdate(str) then if datediff("d",cdate(str),date)=0 then msgbox "是当前日期" else msgbox "不是当前日期" end if else msgbox "不是合法的日期字符串" end if
if formatdatetime(cdate(str),vblongdate)=formatdatetime(now(),vblongdate) then
msgbox "是当前日期"
else
msgbox "不是当前日期"
end if
else
msgbox "不是合法的日期字符串"
end if
Dim str As String
str = "2003-3-27"
If str = Date Then
Debug.Print "a"
End If
End Sub
if datediff("d",cdate(str),date)=0 then
msgbox "是当前日期"
else
msgbox "不是当前日期"
end if
else
msgbox "不是合法的日期字符串"
end if
个人专栏:http://www.csdn.net/develop/author/netauthor/lihonggen0/
------------------------------------------------------------------