php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71383 strtotime(), date() skip hour in "2016-03-13 02:00:00" & "2016-03-13 03:00:00"
Submitted: 2016-01-15 22:36 UTC Modified: 2016-01-16 00:59 UTC
From: traci at jbsystemsllc dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.5.31 OS: OS x 10.8.5
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: traci at jbsystemsllc dot com
New email:
PHP Version: OS:

 

 [2016-01-15 22:36 UTC] traci at jbsystemsllc dot com
Description:
------------
strtotime is returning the same value for "2016-03-13 02:00:00" and "2016-03-13 03:00:00". The resulting date() is incorrect when the hour is 2. During this hour the 3600 seconds that would be added to strtotime is skipped.

Test script:
---------------
for($i=0;$i<10;$i++){
  echo strtotime('2016-03-13 0'.$i.':00:00');
  echo '<br>';
  echo date('g:i A',strtotime('2016-03-13 0'.$i.':00:00'));
  echo '<br>';
}

Expected result:
----------------
1457848800
12:00 AM
1457852400
1:00 AM
1457856000
2:00 AM
1457859600
3:00 AM
1457863200
4:00 AM
1457866800
5:00 AM
1457870400
6:00 AM
1457874000
7:00 AM
1457877600
8:00 AM
1457881200
9:00 AM

Actual result:
--------------
1457848800
12:00 AM
1457852400
1:00 AM
1457856000 (correct strtotime value)
3:00 AM    (incorrect hour value from date)
1457856000 (strtotime skips 3600 seconds)
3:00 AM    
1457859600
4:00 AM
1457863200
5:00 AM
1457866800
6:00 AM
1457870400
7:00 AM
1457874000
8:00 AM
1457877600
9:00 AM

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-16 00:59 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2016-01-16 00:59 UTC] rasmus@php.net
That would be the daylight savings time switch. That is exactly how it works.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 15:01:36 2025 UTC