is_datetime
NAME
is_datetime(): Check whether given string is a valid DATETIME.TYPE
FunctionDESCRIPTION
Test if given text makes for a valid DATETIME object. Returns TRUE (1) when it does, or FALSE (0) when it does not,
SYNOPSIS
is_datetime(txt TINYTEXT) RETURNS TINYINT UNSIGNED
Input:
- txt: text to validate
EXAMPLES
mysql> SELECT is_datetime('2012-01-01') as result1, is_datetime('20120101123456') as result2; +---------+---------+ | result1 | result2 | +---------+---------+ | 1 | 1 | +---------+---------+
mysql> SELECT is_datetime('abc') as result1, is_datetime(17) as result2; +---------+---------+ | result1 | result2 | +---------+---------+ | 0 | 0 | +---------+---------+