|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2020-07-19 02:23 UTC] carusogabriel@php.net
 
-Summary: DateTime->diff having issues with leap days
+Summary: DateTime->diff having issues with leap days for
          timezones ahead of UTC
  [2021-03-24 04:34 UTC] lominum at protonmail dot com
  [2021-04-06 19:55 UTC] derick@php.net
 
-Status:      Open
+Status:      Closed
-Assigned To:
+Assigned To: derick
  [2021-04-06 19:55 UTC] derick@php.net
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 13:00:01 2025 UTC | 
Description: ------------ When in a timezone that's ahead of UTC, DateTime->diff seems to have issues when the starting date falls on a leap day in UTC. In the test script, changing the dates from March 1 to March 2 has both var_dump calls showing 10. Test script: --------------- <?php date_default_timezone_set('UTC'); $d = new DateTime('2008-03-01'); $a = new DateTime('2018-03-01'); var_dump($d->diff($a)->y); date_default_timezone_set('Europe/Amsterdam'); $d = new DateTime('2008-03-01'); $a = new DateTime('2018-03-01'); var_dump($d->diff($a)->y); Expected result: ---------------- int(10) int(10) Actual result: -------------- int(10) int(9)