As we all know, the value of timestamp can be converted into seconds with the help of UNIX_TIMESTAMP() function. MySQL ignores microseconds added to the timestamp value because the value of UNIX_TIMESTAMP is only 10 digits long.
mysql> SELECT UNIX_TIMESTAMP('2017-10-22 04:05:36')AS 'Total Number of Seconds'; +-------------------------+ | Total Number of Seconds | +-------------------------+ | 1508625336 | +-------------------------+ 1 row in set (0.00 sec) mysql> SELECT UNIX_TIMESTAMP('2017-10-22 04:05:36.200000')AS 'Total Number of Seconds'; +-------------------------+ | Total Number of Seconds | +-------------------------+ | 1508625336 | +-------------------------+ 1 row in set (0.00 sec)
The query above shows that the output remains the same even after adding a 6-digit microsecond value.
The above is the detailed content of What does MySQL return when adding microseconds to a timestamp value to convert it to an integer?. For more information, please follow other related articles on the PHP Chinese website!