VBScript IsDate Function

Definition and Usage

The IsDate function returns a boolean value indicating whether the calculated 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 the local settings to detect whether a string can be converted to a date.

Syntax

IsDate(expression)
Parameter Description
expression Required. The expression to be calculated.

Instance

Example 1

document.write(IsDate("April 22, 1947"))

Output:

True

Example 2

document.write(IsDate(#11/11/01#))

Output:

True

Example 3

document.write(IsDate("#11/11/01#"))

Output:

False

Example 4

document.write(IsDate("Hello World!"))

Output:

False