blob: c4a900a4360e40b5b307b22f38290dcdc821e996 [file] [log] [blame]
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +01001``format_date``
2===============
3
4The ``format_date`` filter formats a date. It behaves in the exact same way as
5the :doc:`format_datetime<format_datetime>` filter, but without the time.
6
7.. note::
8
9 The ``format_date`` filter is part of the ``IntlExtension`` which is not
10 installed by default. Install it first:
11
12 .. code-block:: bash
13
14 $ composer require twig/intl-extra
15
16 Then, on Symfony projects, install the ``twig/extra-bundle``:
17
18 .. code-block:: bash
19
20 $ composer require twig/extra-bundle
21
22 Otherwise, add the extension explicitly on the Twig environment::
23
24 use Twig\Extra\Intl\IntlExtension;
25
26 $twig = new \Twig\Environment(...);
27 $twig->addExtension(new IntlExtension());
28
29Arguments
30---------
31
32* ``locale``: The locale
33* ``dateFormat``: The date format
34* ``pattern``: A date time pattern
35* ``timezone``: The date timezone
36* ``calendar``: The calendar (Gregorian by default)