contents.gifindex.gifprev1.gifnext1.gif

IsDate

Purpose

Returns a value indicating whether or not a Variant argument can be converted to a date.

Arguments

IsDate( variant )

Notes

The argument variant can be any Variant expression of VarType 7 (Date) or of VarType 8 (String). The IsDate function returns True (-1) if the Variant can legally be converted to a date; otherwise, it returns False (0). The range of valid dates is January 1, A.D. 100 through December 31, A.D. 9999.

Example

This example evaluates TestVar to determine whether it can be converted to a date and displays an appropriate message.

TestVar = InputBox( "Enter a string you'd like to display as a date." )

If IsDate( TestVar ) Then // Test variable.

MsgBox "The date is: " & Format( CVDate(TestVar),"dddddd" )

Else

MsgBox "TestVar doesn't make sense as a date."

End If