MySQL DATETIME类型和Timestamp之间的转换

DATETIME -> Timestamp: UNIX_TIMESTAMP(...)

Timestamp -> DATETIME: FROM_UNIXTIME(...)

 

mysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(NOW()));
+--------------------------------------+
| FROM_UNIXTIME(UNIX_TIMESTAMP(NOW())) |
+--------------------------------------+
| 2010-09-06 03:27:41                  |
+--------------------------------------+

你可能感兴趣的:(MySQL)