php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64401 21 March 2012 Strange result
Submitted: 2013-03-11 07:29 UTC Modified: 2013-03-12 06:41 UTC
From: mohsen dot taheri at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.3Git-2013-03-10 (Git) OS: Ubuntu
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: mohsen dot taheri at gmail dot com
New email:
PHP Version: OS:

 

 [2013-03-11 07:29 UTC] mohsen dot taheri at gmail dot com
Description:
------------
strtotime("2012-03-21 00:00:01") return value is the same as strtotime("2012-03-21 01:00:01")
both of the are 1332276001
this problem range is 2012-03-21 00:00:00 to 2012-03-21 01:00:00
I don't face this problem in any other dates 

Test script:
---------------
echo date("Y-m-d H:i:s", strtotime("2012-03-21 00:00:01"))."\n";
echo date("Y-m-d H:i:s", strtotime("2012-03-21 01:00:01"))."\n";

Expected result:
----------------
2012-03-21 00:00:01
2012-03-21 01:00:01

Actual result:
--------------
2012-03-21 01:00:01
2012-03-21 01:00:01

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-03-11 12:24 UTC] rasmus@php.net
-Status: Open +Status: Feedback
 [2013-03-11 12:24 UTC] rasmus@php.net
Which timezone? You probably discovered DST in your timezone.
 [2013-03-12 06:23 UTC] mohsen dot taheri at gmail dot com
-Status: Feedback +Status: Open
 [2013-03-12 06:23 UTC] mohsen dot taheri at gmail dot com
I use date_default_timezone_set("Asia/Tehran");
2012-03-21 is the second day of year in Tehran timezone !!!
 [2013-03-12 06:39 UTC] rasmus@php.net
Right, so your result is correct. In 2012 Daylight Savings Time started Midnight 
between Tuesday, March 20 and Wednesday, March 21 where the clocks were set ahead 
by 1 hour. That means that 1 second after midnight became 1 second after 1am 
exactly as you are seeing. So there was never a 2012-03-21 00:00:01.
 [2013-03-12 06:39 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2013-03-12 06:41 UTC] mohsen dot taheri at gmail dot com
Sorry, this was my mistake :(
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Mar 14 08:01:32 2025 UTC