Bug #62353 [Opn]: strtotime fails to interpret time correctly, uses character after decimal point
| From: | pajoye@php.net | Date: | Mon, 18 Jun 2012 17:03:39 +0000 |
| Subject: | Bug #62353 [Opn]: strtotime fails to interpret time correctly, uses character after decimal point | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171345@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62353&edit=1
ID: 62353
Updated by: pajoye@php.net
Reported by: mike dot mackintosh at angrystatic dot com
Summary: strtotime fails to interpret time correctly, uses
character after decimal point
Status: Open
Type: Bug
-Package: date_time
+Package: Date/time related
Operating System: Ubuntu 12.04 x86_64
PHP Version: 5.4Git-2012-06-18 (snap)
Block user comment: N
Private report: N
New Comment:
fix cat
Previous Comments:
------------------------------------------------------------------------
[2012-06-18 16:51:12] mike dot mackintosh at angrystatic dot com
On 6/18/2012 12:50 PM Est, when running:
echo date("m/d/y H:i", strtotime("-1.0 day"));
The following is returned:
06/18/12 09:50
(Minus 3 hours).
------------------------------------------------------------------------
[2012-06-18 16:48:54] mike dot mackintosh at angrystatic dot com
The following behavior is also present:
echo date("m/d/y H:i", strtotime("1.5 days ago"));
Results in -5 days, 5 hours.
It would be expected to return -1 day and 12 hours, being relative.
------------------------------------------------------------------------
[2012-06-18 16:32:25] mike dot mackintosh at angrystatic dot com
Description:
------------
PHP fails to interpret correctly the relative time string when a decimal is used. PHP will use the
character after the decimal point as the multiplier/value in timelib_relative_time. Using an integer
of 1.0, results in no change.
Test script:
---------------
echo date("m/d/y", strtotime("+1.5 years"));
echo date("m/d/y", strtotime("+1.0 years"));
Expected result:
----------------
12/18/13
06/18/13
Actual result:
--------------
06/18/17
06/18/12
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62353&edit=1