【发布时间】:2015-01-13 14:06:40
【问题描述】:
我收到以下格式的日期2015-01-09T20:46:00+0100,需要将其转换为时间戳。
不幸的是,strtotime 函数忽略了时区组件:
print strtotime('2015-01-09T20:46:00+0100') . "\n";
print strtotime('2015-01-09T20:46:00');
//result is the same with or without timezone:
//1420832760
//1420832760
解决这个问题的正确方法是什么?
【问题讨论】:
-
如果它与java有关希望这可能会有所帮助stackoverflow.com/questions/2891361/…>
-
你可能可以这样做
$date = new DateTime('2015-01-09T20:46:00+0100'); echo $date->format('Y-m-d H:i:s');