8a41dd07a727b8bbf0e3e3498265cc9be99f8bbb
[yaffs-website] / vendor / twig / twig / doc / filters / date_modify.rst
1 ``date_modify``
2 ===============
3
4 .. versionadded:: 1.9.0
5     The date_modify filter has been added in Twig 1.9.0.
6
7 The ``date_modify`` filter modifies a date with a given modifier string:
8
9 .. code-block:: jinja
10
11     {{ post.published_at|date_modify("+1 day")|date("m/d/Y") }}
12
13 The ``date_modify`` filter accepts strings (it must be in a format supported
14 by the `strtotime`_ function) or `DateTime`_ instances. You can easily combine
15 it with the :doc:`date<date>` filter for formatting.
16
17 Arguments
18 ---------
19
20 * ``modifier``: The modifier
21
22 .. _`strtotime`: https://secure.php.net/strtotime
23 .. _`DateTime`:  https://secure.php.net/DateTime