time_subtract

Subtracts time from date.

To subtract time, pass the key of what time you want to add, and the amount you want to subtract.

Key can be one of the following:

  • M - months

  • w - weeks

  • d - days

  • h - hours

  • m - minutes

  • s - seconds

{% assign date = "2021-06-07" | time_subtract: 7, "days" | date: "%Y-%m-%d" %}
{{ date | log }}

Above snippet would log 2021-05-31 to logs.

Last updated