skip to Main Content

IntCalendar outputting wrong locale in php

I have the following code which I believe should output fr_FR as the locale but for some reason is outputting en_US_POSIX (it does this on any timezone). What have I done wrong? $loc = IntlCalendar::createInstance(new DateTimeZone('Europe/Paris')); echo $loc->getLocale(Locale::VALID_LOCALE); For refs:…

VIEW QUESTION

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