【发布时间】:2015-08-06 06:02:00
【问题描述】:
我有一个存储在 mysql 中的 unix 时间戳:
1438919940
当我在http://www.onlineconversion.com/unix_time.htm 转换它时,它显示为
Fri, 07 Aug 2015 03:59:00 GMT // this is how I want to display it
在我的代码中,我使用以下方式显示它:
$published = $row['update_date']; //this is where 1438919940 comes from
$published = date ('jS F y @ g:ia',$published);
echo $published;
但这显示为
7th August 15 @ 3:59am
我做的原始 strtotime 是 PDT 时间,我的服务器设置为 Europe/London,在我的脚本中我有
date_default_timezone_set('Europe/London');
在线转换网站如何将其与“正确”(我想要的)版本相呼应,并且我正在获得未来的约会!
【问题讨论】:
-
以 GMT 格式存储日期和时间,并根据用户时区运行时更改时区
-
你以后怎么约会?还是 2015 年 8 月 7 日凌晨 3:59?也许您需要“gmdate”而不仅仅是“date”?
标签: php date unix-timestamp