Description
IsDateTime returns True if the given String or Number value can be converted to a valid DateTime and returns False otherwise.
Arguments
string is a String value or expression to be tested for being convertible to a DateTime value. Many forms are accepted.
number is a Number value or expression to be tested for being convertible to a DateTime value. It can be positive, negative or fractional. It is interpreted as a number of days since December 30, 1899.
Returns
Boolean value (True or False).
Action
IsDateTime returns True if the given String or Number value can be converted to a valid DateTime and returns False otherwise. A valid DateTime is any date-time between January 1, 100 through December 31, 9999.
Typical use
If you want to convert a String value to a DateTime using the functions CDateTime or DateTimeValue, use the IsDateTime function first to check if the conversion will succeed. See the examples section of
IsDate for an example of this type.
Examples
IsDateTime ("September 30, 1999")
Returns True since the given string "September 30, 1999 is interpreted as the DateTime value September 30, 1999, 12:00:00am.
IsDateTime (-100.2)
Returns True since the given number argument is interpreted as the DateTime value September 20, 1899, 7:12:00 pm.