Bug #71383 [Opn->Nab]: strtotime(), date() skip hour in "2016-03-13 02:00:00" & "2016-03-13 03:00:00"

From: Date: Sat, 16 Jan 2016 00:59:57 +0000
Subject: Bug #71383 [Opn->Nab]: strtotime(), date() skip hour in "2016-03-13 02:00:00" & "2016-03-13 03:00:00"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198703@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71383&edit=1

 ID:                 71383
 Updated by:         rasmus@php.net
 Reported by:        traci at jbsystemsllc dot com
 Summary:            strtotime(), date() skip hour in  "2016-03-13
                     02:00:00" & "2016-03-13 03:00:00"
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Date/time related
 Operating System:   OS x 10.8.5
 PHP Version:        5.5.31
 Block user comment: N
 Private report:     N

 New Comment:

That would be the daylight savings time switch. That is exactly how it works.


Previous Comments:
------------------------------------------------------------------------
[2016-01-15 22:36:25] 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


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71383&edit=1


Thread (2 messages)

« previous php.bugs (#198703) next »