使用ISO 8601日期转换的php字符串的可能原因再增加一个小时

时间:2012-06-08 15:03:23

标签: php datetime strtotime iso8601

基本上我有这个:

$data_start = '2012-06-07T13:00:00Z';

if (($timestamp = strtotime($data_start)) === false) {
    return "The string ($data_start) is bogus";
} else {
    return "$data_start == " . date('l dS \o\f F Y H:i:s', $timestamp);
}

它正在回归:

"Thursday 07th of June 2012 14:00:00"

为什么地球上的时间会增加1小时!?与时区有什么关系?

1 个答案:

答案 0 :(得分:0)

$ data_start上的最后一个Z表示日期是UTC时间。 我想你的当地时区是UTC +1?

如果您想始终使用UTC时间,可以使用类似:date_default_timezone_set('UTC')来绕过您当地的时区设置