mysql 时间与时间戳转换方式

tech2026-01-29  8

1、时间转时间戳;

mysql> select unix_timestamp('2018-01-15 09:45:16'); +---------------------------------------+ | unix_timestamp('2018-01-15 09:45:16') | +---------------------------------------+ | 1515980716 | +---------------------------------------+ 1 row in set (0.00 sec)

2、时间戳转时间

mysql> SELECT from_unixtime(1584524789); +------------------------------------------------+ | from_unixtime(1584524789) | +------------------------------------------------+ | 2018-01-15 09:45:16 | +------------------------------------------------+ 1 row in set (0.00 sec)
最新回复(0)