In MySQL, UNIX timestamps are stored as 32-bit integers. MySQL TIMESTAMPS, on the other hand, are stored in a similar manner but in the human-readable YYYY-MM-DD HH:MM:SS format.
mysql> Select UNIX_TIMESTAMP('2017-09-25 02:05:45') AS 'UNIXTIMESTAMP VALUE'; +---------------------+ | UNIXTIMESTAMP VALUE | +---------------------+ | 1506285345 | +---------------------+ 1 row in set (0.00 sec)
The above query shows that UNIX TIMESTAMPS values are stored as 32-bit integers with the same range as the MySQL INTEGER data type range.
mysql> Select FROM_UNIXTIME(1506283345) AS 'MySQLTIMESTAMP VALUE'; +----------------------+ | MySQLTIMESTAMP VALUE | +----------------------+ | 2017-09-25 01:32:25 | +----------------------+ 1 row in set (0.00 sec)
The above query shows that MySQL TIMESTAMPS values are also stored as 32-bit integers, but in a readable format with the same range as the MySQL TIMESTAMP data type range.
The above is the detailed content of What is the difference between UNIX TIMESTAMPS and MySQL TIMESTAMPS?. For more information, please follow other related articles on the PHP Chinese website!