php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43176 strtotime('2007-10-28') + 24*3600 returns wrong date
Submitted: 2007-11-02 11:35 UTC Modified: 2007-11-02 12:19 UTC
From: devil1591 at yahoo dot fr Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.4.7 OS: windows 2000
Private report: No CVE-ID: None
 [2007-11-02 11:35 UTC] devil1591 at yahoo dot fr
Description:
------------
echo date('Y-m-d', strtotime('2007-10-28') + 24*3600);
returns 2007-10-28 which is wrong, you need 3600 seconds more to get 2007-10-29

Reproduce code:
---------------
echo date('Y-m-d', strtotime('2007-10-28') + 24*3600);


Expected result:
----------------
2007-10-29

Actual result:
--------------
2007-10-28

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-02 12:19 UTC] derick@php.net
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which do
not suffer from DST.

just use strtotime( \"2007-10-28 +1 day\" ); - that will work fine
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 16 18:01:34 2024 UTC