|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-12-04 08:43 UTC] bstanescu at gmail dot com
Description: ------------ DateTime diff method returns incorrect result when using milliseconds This might be related to this fix introduced in 7.2.12: https://bugs.php.net/bug.php?id=77007 Test script: --------------- <?php $diff = (new DateTime('2018-12-04T07:42:59.123Z'))->diff(new DateTime('2018-12-04T07:42:59.122Z'); print_r($diff); ?> Expected result: ---------------- DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [f] => -0.123 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) Actual result: -------------- DateInterval Object ( [y] => -1 [m] => 11 [d] => 29 [h] => 23 [i] => 59 [s] => 59 [f] => 0.999 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 04:00:02 2025 UTC |
Edit: Expected fraction is [f] => -0.001 Not [f] => -0.123