我希望使用PHP将MySQL timestamp转换为以秒为单位的纪元时间,反之亦然。
PHP
MySQL timestamp
做这件事最干净的方法是什么?
发布于 2008-09-22 15:27:39
参见手册中的strtotime和date函数。
$unixTimestamp = strtotime($mysqlDate); $mysqlDate = date('Y-m-d h:i:s', $unixTimestamp);
发布于 2008-09-22 15:27:57
从MySQL时间戳到纪元秒:
strtotime($mysql_timestamp);
从纪元秒到MySQL时间戳:
$mysql_timestamp = date('Y-m-d H:i:s', time());
https://stackoverflow.com/questions/115428
相似问题