Can someone tell me how to switch the locale date format in Symfony2?
no matter what I set in config (framework.session.default_locale), this always returns week days in english ( I would need the weekday in german language):
$start->format("D d.m.Y");
when I output the default locale it always returnes “de” BTW, no matter what I setup in the config.yml
echo \Locale::getDefault()
ADDITIONAL INFOS:
I want to be able to format the date in a way that it gets outputted correctly (meaning with correct german weekdays) on my local system AND on the live server. Tried this with strftime which uses the system’s installed locales and had real troubles with it, since the locale packages have different naming schemes on the live and dev machines.
There is another SO question regarding this here:
PHP: why is my date formated on the server differently?
I used such code to format dates in my project (You will need to turn on intl extension for php):
And it works fine for me. How to create formatting patter you can find at
http://userguide.icu-project.org/formatparse/datetime
But I didn’t found a helper for twig, so you can create your own