当我尝试用USEastern时区转换字符串时,strotime返回false,我应该使用哪个时区而不是那个时区


strotime return false when i try to convert a string with USEastern timezone, which timezone should i use instead of that?

如果我进行

$time = strtotime( '2013-3-16 11:40:00 US/Eastern' );
echo $time;

$time是错误的。字符串是通过编程生成的,所以我可以将时区更改为支持的时区,我应该使用什么?

我认为这应该有效:

$time = DateTime::createFromFormat('Y-n-j H:i:s', 
          '2013-3-16 11:40:00', new DateTimeZone('US/Eastern'));
print $time->getTimestamp();
date_default_timezone_set('US/Eastern'); 
$time = strtotime( '2013-3-16 11:40:00' );
echo $time;

和@One Trick Pony相比,它产生了相同的结果。演示

请参阅本页

http://php.net/manual/en/datetime.settimezone.php

帮助您设置时区