Functions

date

The date function converts an argument to a date to allow date comparison.

{% if date(user.created_at) < date('-2days') %}
  {# do something #}
{% endif %}

You can pass a timezone as the second argument:

{% if date(user.created_at) < date('-2days', 'Europe/Paris') %}
  {# do something #}
{% endif %}

If no argument is passed, the function returns the current date:

{% if date(user.created_at) < date() %}
  {# always! #}
{% endif %}

Arguments

ArgumentDescriptionType
dateThe dateAny
timezoneThe timezoneString

Last updated on

On this page