1``timezone_name``
2=================
3
4.. versionadded:: 2.12
5
6    The ``timezone_name`` filter was added in Twig 2.12.
7
8The ``timezone_name`` filter returns the timezone name given a timezone identifier:
9
10.. code-block:: twig
11
12    {# Central European Time (Paris) #}
13    {{ 'Europe/Paris'|timezone_name }}
14
15    {# Pacific Time (Los Angeles) #}
16    {{ 'America/Los_Angeles'|timezone_name }}
17
18By default, the filter uses the current locale. You can pass it explicitly:
19
20.. code-block:: twig
21
22    {# heure du Pacifique nord-américain (Los Angeles) #}
23    {{ 'America/Los_Angeles'|timezone_name('fr') }}
24
25.. note::
26
27    The ``timezone_name`` filter is part of the ``IntlExtension`` which is not
28    installed by default. Install it first:
29
30    .. code-block:: bash
31
32        $ composer require twig/intl-extra
33
34    Then, on Symfony projects, install the ``twig/extra-bundle``:
35
36    .. code-block:: bash
37
38        $ composer require twig/extra-bundle
39
40    Otherwise, add the extension explicitly on the Twig environment::
41
42        use Twig\Extra\Intl\IntlExtension;
43
44        $twig = new \Twig\Environment(...);
45        $twig->addExtension(new IntlExtension());
46
47Arguments
48---------
49
50* ``locale``: The locale
51