php.ini disable daylight saving

柔情痞子 提交于 2019-12-23 21:16:37

问题


Our country stopped daylight saving. Now the time is 20:16 But on PHP the time is 21:16. Is there any way to disable daylight saving? My code is:

echo date('Y-m-d H:i:s');

回答1:


The 2016 change for Azerbaijan is correctly reflected in the time zone database for the Asia/Baku time zone as of release 2016c.

PHP gets its time zone information from the timezonedb PECL package. The 2016c tz data, inclusive of the Azerbaijan change, is in timezonedb version 2016.3.

An embedded copy of this is included with each release of PHP, but occasionally there is a need to install it manually, because the releases are not necessarily aligned. In this case, the latest version of PHP was released on March 3rd, and the version of timezonedb you need was released on March 24th.

There's a good article here describing how exactly to install the timezonedb PECL package. After you install the latest version, you should see your code display the correct time.

Also, recognize that the Azerbaijan government only announced the change on March 17th, leaving very little time for implementation changes. Whenever governments provide short notice, situations like yours are bound to arise. If at all possible, please give feedback to your government to provide more lead time if any other changes are to occur in the future.




回答2:


The same problem happened to me: Brazil stopped observing daylight saving time in the year 2019 and as a result, my Xampp installation started showing the wrong time in the summer.

The problem was fixed changing the timezone in php.ini file to a UTC-3 region where DST has never been observed (America/Paramaribo, America/Cayenne) or to a UTC-3 region where DST was not observed before PHP 5.6 (America/Bahia, America/Buenos_Aires).

That was the only possible solution for me, as the Windows DLL of timezonedb PECL package, referred by Matt Johnson-Pint, was simply incompatible with my Xampp version.



来源:https://stackoverflow.com/questions/36249673/php-ini-disable-daylight-saving

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!