How to set daylight saving to off in php

不想你离开。 提交于 2019-12-08 00:06:56

问题


I've got this line of code which set daylight saving "On" what would be the proper way to set it to "off"

// is daylight saving On?
$rcmail_config['dst_active'] = (bool)date('I');

回答1:


date('I') (that's a capital letter i) returns 1 when the current default time zone is in DST.

If it's returning 1 instead of 0 and the timezone in question is not in DST, either the timezone you've picked is incorrect or the time zone data it uses is out of date.

If you can, please try using a DateTime object with a DateTimeZone object that has been set to the proper time zone. A format('I') call on the resulting object should be correct. If it isn't, then your time zone data is out of date. This is sometimes done at the server level. Please ensure that the server's time zone database is up to date. PHP sometimes includes it's own time zone data file, so you may need to actually update PHP instead.



来源:https://stackoverflow.com/questions/5330983/how-to-set-daylight-saving-to-off-in-php

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