Skip to main content
Question

Pipelines Jinja Expression for Day of Week

  • Jan 30, 2024 11:31 PM UTC
  • 0 replies
  • 936 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
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+9
  • Qrew Colonel
  • Jan 30, 2024 11:53 PM UTC

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