加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 将Twitter-API日期时间更改为时间戳的最佳方法

发布时间:2020-12-13 16:02:54 所属栏目:PHP教程 来源:网络整理
导读:Twitter API发送created_at日期时间如下: "created_at": "Mon Jul 25 05:51:34 +0000 2011", 在时间戳和我当地时区(欧洲/苏黎世)转换它们的最佳方法是什么?使用strtotime(),我得到像2013-11-08 20:07:00的结果 非常感谢你 最好的祝福 $datetime = new Date
Twitter API发送created_at日期时间如下:
"created_at": "Mon Jul 25 05:51:34 +0000 2011",

在时间戳和我当地时区(欧洲/苏黎世)转换它们的最佳方法是什么?使用strtotime(),我得到像2013-11-08 20:07:00的结果

非常感谢你

最好的祝福

$datetime = new DateTime("Mon Jul 25 05:51:34 +0000 2011");
$datetime->setTimezone(new DateTimeZone('Europe/Zurich'));
echo $datetime->format('U');

DateTime,DateTime::format(),DateTime::setTimezone(),DateTimeZonedate()

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读