Introduction

The date_modify filter allows modifying dates by adding or subtracting time periods such as days, months, or years. It is useful for dynamically adjusting the date in contexts where deadlines need to be manipulated or future and past dates calculated.

Example of use

Example of how to add seven days to a specific date using the date_modify filter:

{{ NOW|date|date_modify('+7 days')|date('d/m/Y') }}

In this example, we use a combination of filters to manipulate the current date.
The goal is to get today’s date, add seven days to it using date_modify, and format the result with date.

Example Output Code