php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40861 strtotime() behaviour has changed
Submitted: 2007-03-20 09:07 UTC Modified: 2007-04-11 14:37 UTC
From: eheien at heli-one dot ca Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.2.1 OS: Windows 2003 and XP
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: eheien at heli-one dot ca
New email:
PHP Version: OS:

 

 [2007-03-20 09:07 UTC] eheien at heli-one dot ca
Description:
------------
strtotime() fails when supplied with both a negative and positive argument. This worked in php 5.0.5 and php 4.x.x.

+- = -
++ = +
-- = +


Reproduce code:
---------------
$offset = -60;
$ts = strtotime('2000-01-01 12:00:00');
$result = date("Y-m-d H:i:s", strtotime("+$offset minutes", $ts));
echo $result;

Expected result:
----------------
2000-01-01 11:00:00

Actual result:
--------------
1970-01-01 01:00:00

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-21 00:25 UTC] [email protected]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2007-03-21 09:41 UTC] [email protected]
Reverted that patch, as it was incorrect. 
 [2007-04-11 14:37 UTC] [email protected]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC