如何使用PHP将MySQL时间转换为UNIX时间戳? [英] How to convert MySQL time to UNIX timestamp using PHP?
本文介绍了如何使用PHP将MySQL时间转换为UNIX时间戳?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
关于"UNIX时间戳到MySQL时间"的问题很多.我需要相反的方式,是的...知道吗?
There are a lot of questions that ask about 'UNIX timestamp to MySQL time'. I needed the reversed way, yea... Any idea?
推荐答案
使用 strtotime(..)
:
$timestamp = strtotime($mysqltime);
echo date("Y-m-d H:i:s", $timestamp);
也可以检查一下(以MySQL方式完成).
Also check this out (to do it in MySQL way.)
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_unix-timestamp
这篇关于如何使用PHP将MySQL时间转换为UNIX时间戳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文