-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Description
Description
When using '2022-01-01' as date, IntlDateFormatter returns year 2021 instead of 2022. Same when using '2022-01-02', but when using '2022-01-03' you will get the correct year.
The following code:
<?php
echo IntlDateFormatter::formatObject(DateTime::createFromFormat('Y-m-d', '2022-01-01'), "MMMM Y").PHP_EOL;
echo IntlDateFormatter::formatObject(new DateTime('2022-01-01'), "MMMM Y").PHP_EOL.PHP_EOL;
echo IntlDateFormatter::formatObject(DateTime::createFromFormat('Y-m-d', '2022-01-03'), "MMMM Y").PHP_EOL;
echo IntlDateFormatter::formatObject(new DateTime('2022-01-03'), "MMMM Y");
Resulted in this output:
januari 2021
januari 2021
januari 2022
januari 2022
But I expected this output instead:
januari 2022
januari 2022
januari 2022
januari 2022
PHP Version
PHP 8.2.1
Operating System
No response