skip to Main Content

Can someone explain why there's a one-year difference in the results of PHP's date diff function for these two dates with the same timezone?

$a = new DateTime("2023-05-31", new DateTimeZone('Europe/Rome')); $b = new DateTime("1970-05-31", new DateTimeZone('Europe/Rome')); var_dump($a->diff($b)->y); // int(52) $a = new DateTime("2023-05-30", new DateTimeZone('Europe/Rome')); $b = new DateTime("1970-05-30", new DateTimeZone('Europe/Rome')); var_dump($a->diff($b)->y); // int(53) Why in the first case the diff is 52? I…

VIEW QUESTION
Back To Top
Search