Skip to main content
Question

Pipelines Jinja Expression for Day of Week

  • January 30, 2024
  • 0 replies
  • 916 views

SSNJeffP
Forum|alt.badge.img+11

I'm trying to figure out this expression that would return TRUE If the current day is not sunday but I'm having some trouble with the jinja here.   

{% if (now | weekday) != 6 %}
{#TRUE if The current day is NOT Sunday#}
{% endif %}

I know that first line is wrong, but I'm not clear on what the correct syntax should be.  Anyone have any idea?



------------------------------
Jeff Peterson
------------------------------

Forum|alt.badge.img+9
  • Registered
  • January 30, 2024

You can use strftime for simplicity like so: 

{% if time.today.strftime("%w") == "0" %}

Note that day of week is 0 indexed so Sunday is 0, Saturday is 6



------------------------------
Chayce Duncan
------------------------------