|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-06-18 16:32 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 05:00:01 2025 UTC |
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.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).