ISDATE() Function in SQL Server

Rumman Ansari   Software Engineer   2023-03-25   5722 Share
☰ Table of Contents

Table of Content:


Syntax:


ISDATE() 

Checks if the given value, is a valid date, time, or datetime. Returns 1 for success, 0 for failure.

Code:


Select ISDATE('RABMO') -- returns 0
Select ISDATE(Getdate()) -- returns 1
Select ISDATE('2019-08-31 21:02:04.167') -- returns 1

Output:

The above code will produce the following result-


0
1
1

Note: For datetime2 values, IsDate returns ZERO.


Select ISDATE('2019-09-01 11:34:21.1918447') -- returns 0.