|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2005-02-25 08:22 UTC] zini10 at 012 dot net dot il
 Description:
------------
strtotime() will not parse the following call the right way:
strtotime("2005-02-28 00:00:00 - 3 months")
but will parse this correctly:
strtotime("2005-02-28 00:00:00 + -3 months")
Reproduce code:
---------------
print date("Y-m-d h:m:s",strtotime("2005-02-28 00:00:00 - 3 months"));
print date("Y-m-d h:m:s",strtotime("2005-02-28 00:00:00 + -3 months"));
Expected result:
----------------
2004-11-25 12:11:00
Actual result:
--------------
2005-05-25 12:05:00
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Thu Oct 30 18:00:02 2025 UTC | 
<? print date("Y-m-d h:m:s",strtotime("2005-02-28 00:00:00 -3 months")); ?> works fine (note that there is no space between "-" and "3").