在PHP中将TIMESTAMP转换为Unix时间? [英] Converting TIMESTAMP to unix time in PHP?

查看:148
本文介绍了在PHP中将TIMESTAMP转换为Unix时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我将时间存储在数据库中,如下所示:2010-05-17 19:13:37

Currently I store the time in my database like so: 2010-05-17 19:13:37

但是,我需要比较两次,并且我觉得如果它是unix时间戳(例如1274119041)会更容易. (这两次是不同的)

However, I need to compare two times, and I feel it would be easier to do if it were a unix timestamp such as 1274119041. (These two times are different)

那么如何将时间戳转换为unix时间戳?是否有一个简单的php函数?

So how could I convert the timestamp to unix timestamp? Is there a simple php function for it?

推荐答案

您正在寻找 strtotime()

这篇关于在PHP中将TIMESTAMP转换为Unix时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆