DateTime diff result error.

From: Date: Thu, 14 Jul 2022 07:06:40 +0000
Subject: DateTime diff result error.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241926@lists.php.net to get a copy of this message
Please read the relevant test code.  $start_date = '2024-09-01';  $end_date = '2024-10-01'; $end_datetime= new \DateTime($end_date); $start_datetime = new \DateTime($start_date);  $date_interval = $end_datetime->diff($start_datetime); $diff_months = $date_interval->m; The expected output value is 1, but 0 is actually output. After testing, as long as such operations are performed in September and October of the same year, the results are all 0. The version currently in use is 7.4.3.       2022-07-14       HuangHu

« previous php.bugs (#241926) next »