How can I check if today is the second or last sunday of this month? My effort:
{% set now = now|date('U') %}
{% set monthyear = now|date('F Y') %}
{% set secondSunday = now|date_modify("#{monthyear} second sunday")|date('U') %}
{% set lastSunday = now|date_modify("#{monthyear} last sunday")|date('U') %}
{# check if now is second or last sunday #}
{% if now == secondSunday or now == lastSunday %}
{# YES, today is the second or the last sunday #}
{% else %}
{# NOPE #}
{% endif %
But I keep getting the following error:
DateTime::modify(): Failed to parse time string (juni 2017 second sunday) at position 0 (j): The timezone could not be found in the database
Maybe it doesn't work because the monthyear variable is formed in dutch and not english? (juni = june) If this is the case, how can I modify this to english in order to get it to work?
Also, my timezone is correctly set to UTC+2 (CEST) - Europe/Brussels via Settings > General
Thanks!