Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame^] | 1 | ``date_modify`` |
| 2 | =============== |
| 3 | |
| 4 | The ``date_modify`` filter modifies a date with a given modifier string: |
| 5 | |
| 6 | .. code-block:: twig |
| 7 | |
| 8 | {{ post.published_at|date_modify("+1 day")|date("m/d/Y") }} |
| 9 | |
| 10 | The ``date_modify`` filter accepts strings (it must be in a format supported |
| 11 | by the `strtotime`_ function) or `DateTime`_ instances. You can combine |
| 12 | it with the :doc:`date<date>` filter for formatting. |
| 13 | |
| 14 | Arguments |
| 15 | --------- |
| 16 | |
| 17 | * ``modifier``: The modifier |
| 18 | |
| 19 | .. _`strtotime`: https://secure.php.net/strtotime |
| 20 | .. _`DateTime`: https://secure.php.net/DateTime |