php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65811 Invalid hour returned on DST change
Submitted: 2013-10-02 11:32 UTC Modified: 2017-03-19 11:05 UTC
Votes:5
Avg. Score:5.0 ± 0.0
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:4 (80.0%)
From: glavic at gmail dot com Assigned:
Status: Duplicate Package: Date/time related
PHP Version: Irrelevant OS: ALL
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: glavic at gmail dot com
New email:
PHP Version: OS:

 

 [2013-10-02 11:32 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-17 21:43 UTC] mark at mpen dot ca
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.
 [2017-03-19 11:05 UTC] heiglandreas@php.net
-Status: Open +Status: Duplicate
 [2017-03-19 11:05 UTC] heiglandreas@php.net
We're now tracking this in https://bugs.php.net/bug.php?id=74274
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 21:01:36 2024 UTC