php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47271 Datetime::Modify
Submitted: 2009-02-02 09:58 UTC Modified: 2009-02-02 10:23 UTC
From: mguichar at univ-lr dot fr Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.8 OS: Windows / Linux
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mguichar at univ-lr dot fr
New email:
PHP Version: OS:

 

 [2009-02-02 09:58 UTC] mguichar at univ-lr dot fr
Description:
------------
When I add 1 hour to Datetime Object (using modify function), it's not 1 hour but 2 hour which are added. This bug appear only for date : 2001-03-25 01:03:00 / 2002-03-31 01:03:00 / 2003-03-30 01:03:00 / 2004-03-28 01:03:00 / 2005-03-27 01:03:00 / 2006-03-26 01:03:00 / 2007-03-25 01:03:00 / 2008-03-30 01:03:00

Reproduce code:
---------------
$date= date_create('2001-03-25 01:03:00');
echo $date->format("Y-m-d H:m:s")." +1 hour =>\n";
$date->modify("+1 hour");
echo $date->format("Y-m-d H:m:s")."\n\n";

$date= date_create('2002-03-31 01:03:00');
echo $date->format("Y-m-d H:m:s")." +1 hour =>\n";
$date->modify("+1 hour");
echo $date->format("Y-m-d H:m:s")."\n\n";

...

Expected result:
----------------
2001-03-25 01:03:00 +1 hour =>
2001-03-25 02:03:00

2002-03-31 01:03:00 +1 hour =>
2002-03-31 02:03:00

...

Actual result:
--------------
2001-03-25 01:03:00 +1 hour =>
2001-03-25 03:03:00

2002-03-31 01:03:00 +1 hour =>
2002-03-31 03:03:00

...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-02 10:06 UTC] mguichar at univ-lr dot fr
Same bug with date :
1998/03/29
1999/03/28
2000/03/26
and probably for each year before 1998 !
 [2009-02-02 10:20 UTC] mguichar at univ-lr dot fr
Error come from default timezone ...
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Nov 29 09:00:01 2025 UTC