ISDATE (Transact-SQL)

Returns 1 if the expression is a valid date, time, or datetime value; otherwise, 0.

ISDATE returns 0 if the expression is a datetime2 value.

For an overview of all Transact-SQL date and time data types and functions, see Date and Time Data Types and Functions (Transact-SQL). Note that the range for datetime data is 1753-01-01 through 9999-12-31, while the range for date data is 0001-01-01 through 9999-12-31.

Is a character string or expression that can be converted to a character string. The expression must be less than 4,000 characters. Date and time data types, except datetime and smalldatetime, are not allowed as the argument for ISDATE.

For examples of valid formats for which ISDATE will return 1, see the section "Supported String Literal Formats for datetime" in the datetime and smalldatetime topics. For additional examples, also see the Input/Output column of the "Arguments" section of CAST and CONVERT.

The following table summarizes input expression formats that are not valid and that return 0 or an error.

ISDATE expression

ISDATE return value

NULL

0

Values of data types listed in Data Types in any data type category other than character strings, Unicode character strings, or date and time.

0

Values of text, ntext, or image data types.

0

Any value that has a seconds precision scale greater than 3, (.0000 through .0000000...n). ISDATE will return 0 if the expression is a datetime2 value, but will return 1 if the expression is a valid datetime value.

0

Any value that mixes a valid date with an invalid value, for example 1995-10-1a.