MySQL returns 0 when we pass out-of-range value in UNIX_TIMESTAMP. The valid range of values is the same as the TIMESTAMP data type.
mysql> Select UNIX_TIMESTAMP('1969-01-01 04:05:45'); +---------------------------------------+ | UNIX_TIMESTAMP('1969-01-01 04:05:45') | +---------------------------------------+ | 0 | +---------------------------------------+ 1 row in set (0.00 sec)
MySQL returns NULL when we pass an out-of-range value in FROM_UNIXTIME. The valid range of values is the same as the INTEGER data type.
mysql> Select FROM_UNIXTIME(2147483648); +---------------------------+ | FROM_UNIXTIME(2147483648) | +---------------------------+ | NULL | +---------------------------+ 1 row in set (0.00 sec)
The above is the detailed content of What does MySQL return when you pass an out-of-range value in the UNIX_TIMESTAMP() or FROM_UNIXTIME() function?. For more information, please follow other related articles on the PHP Chinese website!