ISDATE

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.

Syntax

ISDATE ( expression )

Arguments

expression

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.

Return types

int

Example

IF ISDATE('2017-04-24 11:25:56.342') = 1
    SELECT 'true'
ELSE
    SELECT 'false';

See Also