[英]PHP strtotime to return as UTC timestamp?
Its a bit of a sever difference problem.它有点严重的差异问题。 On my local dev.在我的本地开发人员上。 server Im using:服务器我正在使用:
<?php print strtotime($date." UCT"); ?>
The above code gives me the correct timestamp for my timezone.上面的代码为我的时区提供了正确的时间戳。 HOWEVER, the same code returns false on the live server.但是,相同的代码在实时服务器上返回 false。
The live server has a lower version of php installed and I imagine that to be the problem.实时服务器安装了较低版本的 php,我想这就是问题所在。
What I'm looking for is an alternative to the above line of code.我正在寻找的是上述代码行的替代方案。
I could use the normal strototime without the." UCT" part and add in 2hours but would rather have PHP handle timezones.我可以使用没有“UCT”部分的正常 strototime 并添加 2 小时,但宁愿让 PHP 处理时区。
$date looks like this: 2011-05-25 05:48:00 $date 看起来像这样:2011-05-25 05:48:00
<?php print strtotime($date." UTC"); ?>
instead of代替
<?php print strtotime($date." UCT"); ?>
PHP warning on PHP documentation page, no support for UCT there: PHP 文档页面上的 PHP 警告,那里不支持 UCT:
http://www.php.net/manual/en/timezones.others.php http://www.php.net/manual/en/timezones.others.php
Warning
Please do not use any of the timezones listed here (besides UTC), they only exist for backward compatible reasons.
And here is latest PECL timezon database:这是最新的 PECL 时区数据库:
http://pecl.php.net/get/timezonedb http://pecl.php.net/get/timezonedb
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.