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
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: devil1591 at yahoo dot fr
New email:
PHP Version: OS:

 

 [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 22:01:27 2024 UTC