Bug #76983 [Com]: date('i') returns wrong value for Dublin timezone
| From: | tomas at matrixinternet dot ie | Date: | Mon, 08 Oct 2018 08:42:16 +0000 |
| Subject: | Bug #76983 [Com]: date('i') returns wrong value for Dublin timezone | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-217467@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76983&edit=1
ID: 76983
Comment by: tomas at matrixinternet dot ie
Reported by: tomas at matrixinternet dot ie
Summary: date('i') returns wrong value for Dublin timezone
Status: Feedback
Type: Bug
Package: Date/time related
Operating System: Ubuntu 16.04
PHP Version: 5.6.38
Block user comment: N
Private report: N
New Comment:
Yes, tzdata version on the affected system is 2018e.
Previous Comments:
------------------------------------------------------------------------
[2018-10-08 06:52:56] requinix@php.net
It looks like tzdata had issues with the way it stored DST information for Europe/Dublin. What
version of tzdata do you have installed? Is it at least 2018e?
------------------------------------------------------------------------
[2018-10-08 06:38:55] tomas at matrixinternet dot ie
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!
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76983&edit=1