#33869 [Opn->Asn]: Strtotime no longer parses +1day or +1year etc...
| From: | tony2001@php.net | Date: | Tue, 26 Jul 2005 16:17:28 +0000 |
| Subject: | #33869 [Opn->Asn]: Strtotime no longer parses +1day or +1year etc... | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-82477@lists.php.net to get a copy of this message | ||
ID: 33869
Updated by: tony2001@php.net
Reported By: jeremy at techtrav dot com
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: Windows XP Apache 2
PHP Version: 5.1.0b3
-Assigned To:
+Assigned To: derick
New Comment:
Derick, is it intended change or not?
Previous Comments:
------------------------------------------------------------------------
[2005-07-26 17:47:49] jeremy at techtrav dot com
If you would read my comment you would realize this worked in php
5.0.4. I would assume you would like to keep PHP backwards compatable
with peoples code!
------------------------------------------------------------------------
[2005-07-26 17:45:01] tony2001@php.net
Because you should write "+1 day", instead of "+1day".
Notice the whitespace.
------------------------------------------------------------------------
[2005-07-26 17:38:32] jeremy at techtrav dot com
Description:
------------
the newest snap of php 5.1.X does not parse strtotime properly for
adding days. This used to work in 5.0.4. Look at the reproduceable
code below. The new version only seems to work with a space between
the number and the days or months or years.
Reproduce code:
---------------
$date = strtotime('20 Aug');
echo date('m/d/Y H:m:s', strtotime('+5days',$date));
echo '<br>';
echo date('m/d/Y H:m:s', strtotime('+1month',$date));
echo '<br>';
echo date('m/d/Y H:m:s', strtotime('+1year',$date));
Expected result:
----------------
08/25/2005 00:08:00
09/20/2005 00:09:00
08/20/2006 00:08:00
Actual result:
--------------
01/01/1970 00:01:00
01/01/1970 00:01:00
01/01/1970 00:01:00
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33869&edit=1