沃梦达 / 编程问答 / php问题 / 正文

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

Converting TIMESTAMP to unix time in PHP?(在 PHP 中将 TIMESTAMP 转换为 unix 时间?)

本文介绍了在 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 时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在 PHP 中将 TIMESTAMP 转换为 unix 时间?

基础教程推荐