php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54124 strtotime() returns invalid timestamp with DST transition at new year midnight
Submitted: 2011-02-28 21:57 UTC Modified: 2011-03-01 02:41 UTC
From: tomas dot brastavicius at quantum dot lt Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.3.6RC1 OS: Ubuntu
Private report: No CVE-ID: None
 [2011-02-28 21:57 UTC] tomas dot brastavicius at quantum dot lt
Description:
------------
strtotime() returns invalid timestamp with DST transition at new year midnight

Test script:
---------------
date_default_timezone_set("Europe/Vilnius");
echo date("Y-m-d H:i:s", strtotime("2002-12-31 23:59:59 +1 sec")) . "\n";
date_default_timezone_set("Asia/Baku");
echo date("Y-m-d H:i:s", strtotime("1995-12-31 23:59:59 +1 sec")) . "\n";
date_default_timezone_set("Africa/Cairo");
echo date("Y-m-d H:i:s", strtotime("2010-09-09 23:59:59 +1 sec")) . "\n"; // OK
date_default_timezone_set("Asia/Karachi");
echo date("Y-m-d H:i:s", strtotime("2009-04-14 23:59:59 +1 sec")) . "\n"; // OK

Expected result:
----------------
2003-01-01 01:00:00
1996-01-01 01:00:00
2010-09-10 01:00:00
2009-04-15 01:00:00

Actual result:
--------------
2003-01-01 00:00:00
1996-01-01 00:00:00
2010-09-10 01:00:00
2009-04-15 01:00:00

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-01 02:41 UTC] dtajchreber@php.net
-Status: Open +Status: Bogus
 [2011-03-01 02:41 UTC] dtajchreber@php.net
Vilnius didn't observe have any time changes in 2002 (or until 30 March 2003) and 
Baku didn't observe any changes in 1995 (or until 31 March 1996). The output is 
correct. 

[1] http://www.timeanddate.com/worldclock/timezone.html?n=660&syear=2000
[2] http://www.timeanddate.com/worldclock/timezone.html?n=369&syear=1990
[3] http://en.wikipedia.org/wiki/Tz_database
 [2011-03-01 15:30 UTC] tomas dot brastavicius at quantum dot lt
Sorry, I used not so reliable TZ data source.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 21 01:01:27 2024 UTC