Skip to content

ISDATE

  • expression: A valid character string representation of a date or datetime value. This input is checked by the `ISDATE()` function to determine if it can be converted into a valid date or datetime data type in SQL Server.
DECLARE @date AS VARCHAR(30);
SET @date = '2021-08-15';
SELECT ISDATE(@date) AS 'Result';
Result
----------
1

In the example provided, ISDATE function is used to check whether a string is a valid date. ‘2021-08-15’ is a valid date, thus output returns 1 (true). If the input is not a valid date, ISDATE function will return 0 (false).