{% 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

Was this helpful?

Copyright © 2024 Blutui.