Add days to a date

For example: 10 days after event date

Geertje avatar
Written by Geertje
Updated over a week ago
{% assign seconds = 10 | times: 24 | times: 60 | times: 60 %}
{{ event.date | date: "%s" | plus: seconds | date: "%Y-%m-%d" }}

The code above helps you to create a date that's always, for example, 10 days after your event date. For example a payment deadline you want to add on the invoice. The deadline is 10 days after the event date. The event date is variable.

In the example above it will add 10 days.

If your event date is 14-08-2022, the outcome when using this code will be 28-08-2022.

Change the '10' to any number of days you want.

To learn more about the data-filters, check out this article.

Did this answer your question?