Php Daylight saving issue with Pacific/Fiji
I'm trying to get the timezone offset like this
$zone = new DateTimeZone('Europe/Oslo');
$c = new DateTime(null, $zone);
$offset = $c->getOffset();
$transitions = $zone->getTransitions(time(), time());
echo '<pre>',print_r($transitions),'</pre>';
which returns the offset in seconds which is fine. But this offset is not working correctly for timezone 'Pacific/Fiji'. For Fiji, it returns 46800 ( ie GMT + 13 ) which is not right and it should have been 43200. Google says that fiji is GMT +12 here. I have even tried setting default timezone to Europe/London or UTC but still fiji's offset is not right. The daylight saving flag ( isdst index in $transitions array ) is active for fiji which I think should be false in case of fiji as their daylight saving just ended. Few other timezones have dst active as well like America/Asuncion, America/Campo_Grande, America/Sao_Paulo, Australia/Adelaide etc but all of their offsets are correct.
Any reason why fiji's offset is still showing GMT+13 and not GMT+12 ? I have searched forums the whole day and not a single clue.
PS Fiji: When local daylight time was about to reach Sunday, 18 January 2015, 03:00:00 clocks were turned backward 1 hour to Sunday, 18 January 2015, 02:00:00 local standard time instead.
Fiji's end-of-DST transition (their "fall-back" transition) was recently changed in the underlying data. It was previously set to end on January 24, but was moved one week earlier, to January 17, to align with announcements from the Fijian government.
This change was enacted in version 2015g of the IANA tz database (release notes here). For PHP, you'll find this in version 2015.7 of the timezonedb pecl package. This was released on 2015-10-03, and PHP always grabs the latest timezonedb before each PHP release. So if you update to PHP version 5.6.14 or greater (or 7.0.0 RC5 on the dev preview track), then you'll automatically have the changes. Otherwise, you can update timezonedb manually.
In general, if your application relies on accuracy of local time (especially scheduling scenarios), then you should subscribe to Announcements mailing list at IANA so you know about changes that could impact your system, then watch for the downlevel changes going into libraries, frameworks, and operating systems to make sure they are applied in a timely manner. Otherwise, you risk inconsistencies like the one you described.
链接地址: http://www.djcxy.com/p/29416.html上一篇: CSS边距和填充有什么区别?
下一篇: Php太平洋/斐济的夏令时问题