Description:
Returns a Boolean value indicating whether an expression can be converted to a date.
Syntax:
Boolean IsDate(Variant expression)
Parameters:
expression | (Variant) Date or text string that represents a date or time |
---|
Return values:
true - If the expression is a date or if can be converted to a valid date
false - Otherwise
Note:
In OS Windows, the range of valid dates is from January 1, 100 A.D. to December 31, 9999 A.D. The range vary among operating systems.
Example:
VBScriptSelect and copy to clipboard
Dim MyDate, YourDate, NoDate, bCheck
MyDate = "October 19, 2020"
YourDate = #10/19/17#
NoDate = "Hello"
bCheck = IsDate(MyDate) 'Returns true
bCheck = IsDate(YourDate) 'Returns true
bCheck = IsDate(NoDate) 'Returns false