php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70870 datetime bug
Submitted: 2015-11-06 10:52 UTC Modified: 2015-11-06 12:35 UTC
From: samgolam at 163 dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.6.15 OS: CENTOS 6.5
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: samgolam at 163 dot com
New email:
PHP Version: OS:

 

 [2015-11-06 10:52 UTC] samgolam at 163 dot com
Description:
------------
date('Y-m-d H:i:s',strtotime('1986-05-04 00:00:00')) resutl equl 1986-05-04 01:00:00
$arr = array(
'1986-05-04 00:00:00',
'1987-04-12 00:00:00',
'1988-04-10 00:00:00',
'1989-04-16 00:00:00',
'1990-04-15 00:00:00',
'1991-04-14 00:00:00'
);
just 6 day
Datetime is same as this

Test script:
---------------
$arr = array(
'1986-05-04 00:00:00',
'1987-04-12 00:00:00',
'1988-04-10 00:00:00',
'1989-04-16 00:00:00',
'1990-04-15 00:00:00',
'1991-04-14 00:00:00'
);
foreach($arr as $date){
    echo date('Y-m-d H:i:s',strtotime($date));
}
/**
'1986-05-04 01:00:00',
'1987-04-12 01:00:00',
'1988-04-10 01:00:00',
'1989-04-16 01:00:00',
'1990-04-15 01:00:00',
'1991-04-14 01:00:00'
**/



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-11-06 12:35 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2015-11-06 12:35 UTC] requinix@php.net
Assuming you are using the timezone for China,

Daylight savings in 1986 began on 05-04 at 00:00:00 when the clocks moved forward one hour to 01:00:00. That means 1986-05-04 00:00:00 never happened.

Same for the other dates.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 14:00:02 2026 UTC