Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame^] | 1 | ``format_date`` |
| 2 | =============== |
| 3 | |
| 4 | The ``format_date`` filter formats a date. It behaves in the exact same way as |
| 5 | the :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 | |
| 29 | Arguments |
| 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) |