|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-10-08 06:52 UTC] requinix@php.net
-Status: Open
+Status: Feedback
[2018-10-08 06:52 UTC] requinix@php.net
[2018-10-08 08:42 UTC] tomas at matrixinternet dot ie
[2018-10-09 06:04 UTC] requinix@php.net
[2018-10-09 09:27 UTC] derick@php.net
-Status: Feedback
+Status: Not a bug
[2018-10-09 09:27 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 17 08:00:01 2025 UTC |
Description: ------------ We use date('I') (capital i) to detect daylight saving time being in action or not. It kept returning "1" quite happily throughout the summer. On 29/09/2018 around 7:00 am, it started returning "0", indicating a change to a winter time. This happened pretty much exactly one full month before the change was about to happen on October 29. Linux Timezone is: Europe/Dublin (IST, +0100) PHP timezone is set via date_default_timezone_set('Europe/Dublin'); date('I', strtotime('2018-09-29 02:00:00')) // returns "0" - which is wrong as DST is active now! date('I', strtotime('2018-11-29 02:00:00')) // returns "1" - which is wrong as DST is Summer time! This issue seems to happen specifically on Amazon AWS EC2 instances. A newly installed server instance returns the correct value for around a day, but then it seems to switch over. We weren't able to replicate this issue on a non-AWS instance. Test script: --------------- date_default_timezone_set('Europe/London'); if (date('I', strtotime('2018-09-29 02:00:00'))) { echo 'We are in DST!'; } else { echo 'We are not in DST!'; } date_default_timezone_set('Europe/Dublin'); if (date('I', strtotime('2018-09-29 02:00:00'))) { echo 'We are in DST!'; } else { echo 'We are not in DST!'; } date_default_timezone_set('Europe/Paris'); if (date('I', strtotime('2018-09-29 02:00:00'))) { echo 'We are in DST!'; } else { echo 'We are not in DST!'; } Expected result: ---------------- We are in DST! We are in DST! We are in DST! Actual result: -------------- We are in DST! We are not in DST! We are in DST!