If you run the following code
<?php
$date = new DateTime('2019-12-30 19:45:00', new DateTimeZone('Europe/London'));
$formatter = new IntlDateFormatter(
'en_GB',
null,
null,
'Europe/London',
IntlDateFormatter::GREGORIAN,
'MMMM YYYY'
);
echo $formatter->format($date);
it'll echo December 2020
. Is this a bug with the class, or have I got something wrong, as I'd expect it to return December 2019
According to: https://unicode-org.github.io/icu/userguide/format_parse/datetime/
Y stand for year of "Week of Year"(whatever it means) and y is regular year reference we got used to. So to get current year replace YYYY
with yyyy
and it should do the job