在 PHP 中将 TIMESTAMP 转换为 unix 时间?

2022-01-13 00:00:00 timestamp epoch php unix-timestamp

目前我将时间存储在我的数据库中,如下所示: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()

相关文章