开发者

timezone conversion problem in php

$start = new DateTime('2011-05-06 19:30:00', new DateTimeZone('Pacific/Tongatapu'));
$start->setTimezone(new DateTimeZone('GMT'));
$end   = clone $start;
$end->modify(sprintf('+ %d seconds', 1*60*60));

echo $start->format('Ymd\THis\Z'); //Output 20110506T063000Z
echo "<br/>";
echo $end->format('Ymd\THis\Z'); //Output 20110506T073000Z

Here the output should be 20110507T063000Z and 20110507T073000Z.... can开发者_JS百科 anyone help...? i am not getting the appropriate results...


Why would it be 20110507T073000Z? You're only adding 1*60*60 seconds = 1 hour. Why should both the day and hour change if all you do is add an hour?


The time zone Pacific/Tongatapu is GMT+13, so I would say that PHP is correct.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜