VBScript IsDate Function
- Learn to Code, Build Career!
VBScript IsDate Function
The IsDate function returns a Boolean value indicating whether an expression can be converted to a date. If the expression is a date or can be converted to a date, it returns True. Otherwise, it returns False.
Note: The IsDate function uses local settings to detect if a string can be converted to a date (in all languages, "January" is not a month).
Syntax
IsDate(expression)
| Parameter | Description |
|---|---|
| expression | Required. The expression to calculate. |
Example 1
Valid Date:
document.write(IsDate("April 22, 1947")) document.write("") document.write(IsDate(#01/31/10#))
Output Result:
True
True
Example 2
Invalid Date:
document.write(IsDate("#01/31/10#")) document.write("") document.write(IsDate("52/17/2010")) document.write("
") document.write(IsDate("Hello World!"))
Output Result:
False
False
False
YouTip