|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81273 Date interval calculation not correct
Submitted: 2021-07-19 07:23 UTC Modified: 2021-08-08 12:43 UTC
From: alex dot a dot pott at gmail dot com Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 8.1Git-2021-07-19 (Git) OS: OS X
Private report: No CVE-ID: None
 [2021-07-19 07:23 UTC] alex dot a dot pott at gmail dot com
Date interval calculation is has changed in 8.1 and the new calculation is incorrect.


This seems similar to

Test script:

$time = '2000-01-01 00:00:00.000000';
$tz_aus = new DateTimeZone('Australia/Sydney');
$tz_us = new DateTimeZone('America/Los_Angeles');
$auz = new DateTime($time, $tz_aus);
$us = new DateTime($time, $tz_us);

$diff = $auz->diff($us);
// Should output int(19)

Expected result:
It should output:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-23 10:57 UTC] antonino dot spampinato86 at gmail dot com
Although not related to your problem but to +1 month of php 8.1 (must take the above behavior or change the datetime arithmetic page).
 [2021-08-03 12:42 UTC]
-Assigned To: +Assigned To: derick
 [2021-08-04 08:07 UTC] mail at gh01 dot de
This one also:
 [2021-08-08 11:20 UTC]
@ramsey: none of these are related, only the one by mail at gh01 dot de
 [2021-08-08 12:43 UTC]
-Status: Assigned +Status: Closed
 [2021-08-08 12:43 UTC]
The fix for this bug has been committed.
If you are still experiencing this bug, try to check out latest source from and re-test.
Thank you for the report, and for helping us make PHP better.

For 8.1.0beta3
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 28 01:01:27 2024 UTC