Bug #65811 [Com]: Invalid hour returned on DST change

From: Date: Sun, 17 Jul 2016 21:43:03 +0000
Subject: Bug #65811 [Com]: Invalid hour returned on DST change
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202381@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65811&edit=1

 ID:                 65811
 Comment by:         mark at mpen dot ca
 Reported by:        glavic at gmail dot com
 Summary:            Invalid hour returned on DST change
 Status:             Open
 Type:               Bug
 Package:            Date/time related
 Operating System:   ALL
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Confirmed this is still an issue in PHP 7.0.5.

I've had to convert my dates to UTC and then back again to avoid this bug. Please fix.


Previous Comments:
------------------------------------------------------------------------
[2013-10-02 11:32:12] glavic at gmail dot com

Description:
------------
If I currently have datetime in DST, and then add some interval to that date (to skip DST), invalid
datetime is returned.

How it is: 2013-10-27 01:45 (in DST) + 30 min = 02:15 (not in DST)
How it should be: 2013-10-27 01:45 (in DST) + 30 min = 01:15 (not in DST)

Same for all php versions about >= 5.2.0 : http://3v4l.org/DUO06

Test script:
---------------
$tz = new DateTimezone('Europe/Berlin'); # uses DST
$dt = new DateTime('2013-10-27 01:45:00', $tz);
echo $dt->format('Y-m-d H:i I') . "\n";
$dt->modify("+30 minute");
echo $dt->format('Y-m-d H:i I') . "\n";

Expected result:
----------------
2013-10-27 01:45 1
2013-10-27 01:15 0

Actual result:
--------------
2013-10-27 01:45 1
2013-10-27 02:15 0


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=65811&edit=1


Thread (3 messages)

« previous php.bugs (#202381) next »