Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图在我的数据库中的 php 页面上显示当前服务器时间和 DATETIME(定义为 2012-01-01 00:00:01)条目之间的差异(以秒为单位)。我只想显示最新条目的差异。
我已经能够得到一些结果,但我知道结果不正确。如果有人能够提供帮助,那就太好了。谢谢!
select TIMESTAMPDIFF(second, '2012-01-01 00:00:01', current_timestamp) as date_diff
它很简单:-
echo time() - strtotime('2012-01-01 00:00:01');
时间() strtotime()