Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to enable <a href="http://symfony.com/doc/current/reference/dic_tags.html#twig-extension" rel="nofollow">twig intl extension</a> (it requires enabled <a href="http://www.php.net/manual/en/book.intl.php" rel="nofollow">intl functions</a> in php) a then you just use:</p> <pre><code>{{ event.beginAt | localizeddate('full', 'none', locale) }} </code></pre> <hr> <p><strong>Edited</strong>:<br> If you want to just localized name of day, you can create your own Twig extension:</p> <p><code>src/Acme/Bundle/DemoBundle/Twig/DateExtension.php</code> </p> <pre><code>namespace Acme\Bundle\DemoBundle\Twig; class DateExtension extends \Twig_Extension { public function getFilters() { return array( new \Twig_SimpleFilter('intl_day', array($this, 'intlDay')), ); } public function intlDay($date, $locale = "de_DE") { $fmt = new \IntlDateFormatter( $locale, \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, 'Europe/Berlin', \IntlDateFormatter::GREGORIAN, 'EEEE'); return $fmt-&gt;format($date); } public function getName() { return 'date_extension'; } } </code></pre> <p>Then register it in services.yml</p> <p><code>src/Acme/Bundle/DemoBundle/Resources/config/services.yml</code></p> <pre class="lang-none prettyprint-override"><code>parameters: acme_demo.date_extension.class: Acme\Bundle\DemoBundle\Twig\DateExtension services: acme_demo.twig.date_extension: class: %acme_demo.date_extension.class% tags: - { name: twig.extension } </code></pre> <p>In your Twig template you can use just:</p> <pre class="lang-none prettyprint-override"><code>{{ event.beginAt|intl_day }} {{ event.beginAt|date('d.m.Y') }} </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload