|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-04-06 19:53 UTC] derick@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: derick
[2021-04-06 19:53 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 11:00:02 2025 UTC |
Description: ------------ When you try an absolute diff between '2016-03-31' and '2016-03-01', you'll have an extra day field. Test script: --------------- $date1 = new \DateTime('2016-03-01'); $date2 = new \DateTime('2016-03-31'); $diff = date_diff($date1, $date2, true); var_dump($diff); Expected result: ---------------- class DateInterval#2 (15) { public $y => int(0) public $m => int(1) public $d => int(0) public $h => int(0) public $i => int(0) public $s => int(0) public $weekday => int(0) public $weekday_behavior => int(0) public $first_last_day_of => int(0) public $invert => int(0) public $days => int(30) public $special_type => int(0) public $special_amount => int(0) public $have_weekday_relative => int(0) public $have_special_relative => int(0) } Actual result: -------------- class DateInterval#2 (15) { public $y => int(0) public $m => int(1) public $d => int(1) public $h => int(0) public $i => int(0) public $s => int(0) public $weekday => int(0) public $weekday_behavior => int(0) public $first_last_day_of => int(0) public $invert => int(0) public $days => int(30) public $special_type => int(0) public $special_amount => int(0) public $have_weekday_relative => int(0) public $have_special_relative => int(0) }