isdate¶
This function is used to determine whether a date string can be converted into a date value based on a specified format.
Syntax¶
isdate(string date , string format)
Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
date | Yes | DATE or STRING | String to be checked If the value is of the BIGINT, DOUBLE, DECIMAL, or DATETIME type, the value is implicitly converted to the STRING type for calculation. The value can be any string. |
format | Yes | STRING | Format of the date to be converted Constant of the STRING type. Extended date formats are not supported. The value is a combination of the time unit (year, month, day, hour, minute, and second) and any character.
|
Return Values¶
The return value is of the BOOLEAN type.
Note
If the value of date or format is NULL, NULL is returned.
Example Code¶
The value true is returned.
select isdate('2023-08-10','yyyy-mm-dd');
The value false is returned.
select isdate(123456789,'yyyy-mm-dd');