0
    $user_timezone_from =  'UTC';
    $user_timezone_to =  'Pacific/Auckland';
    $date = new DateTime('2015-08-21 14:00', new DateTimeZone($user_timezone_from)); 
    $date->setTimezone(new DateTimeZone($user_timezone_to)); 
    echo $cur_gmt_date = $date->format('Y-m-d H:i:s');

    $date = new DateTime('2015-09-29 14:00', new DateTimeZone($user_timezone_from)); 
    $date->setTimezone(new DateTimeZone($user_timezone_to)); 
    echo $cur_gmt_date = $date->format('Y-m-d H:i:s');

为此,我得到了不同的结果。

2015-08-22 02:00:00

2015-09-30 03:00:00它应该是2015-09-30 02:00:00

为什么我得到了错误的值?

4

1 回答 1

1

维基百科告诉我,9 月的最后一个星期日,新西兰的夏令时发生了变化。因此与夏令时相差一小时。

于 2014-08-22T05:57:10.497 回答