Reputation: 29
I need to get the name of the day in my native language(polish, pl). So I do:
echo (new \DateTimeImmutable())->format('D'));
And the response is in English: Thu
, despite that the locale
is set to pl
.
To confirm that, the output of this line \Locale::getDefault()
is pl
.
What could be wrong?
I am using php 7.3, symfony 4.4
Upvotes: 0
Views: 162
Reputation: 5703
The format()
method does not use locales, if you look into the php.net documentation:
This method does not use locales. All output is in English.
If you have the intl
extension installed you could use IntlDateFormatter::format
instead.
Upvotes: 2