'Get localized name of day with Twig Intl Extension
Using the Twig Intl Extension in a symfony project gives you the Twig Filter localizeddate.
You can even choose from some "presets" like {{ date|localizeddate('full', 'medium') }} to print out a value (german locale) like: Montag, 24. August 2015 um 23:00:00
But how can I just output the name of the day?
Note: {{ date.format('D') }} will output the name of the day in the english language, not the current locale set in symfony / twig environment.
Solution 1:[1]
Try this:
{{ date|localizeddate('full', 'none', app.request.locale, null, 'EEE') }}
Read the docs for the function here.
Solution 2:[2]
Try the following
{{ date.format('D')|trans }}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | duellsy |
