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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
15 + 30 = ?
Subscribe to this entry?

 
 [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

Pull Requests

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 Oct 31 23:01:28 2024 UTC