Forum Discussion

JeffPeterson1's avatar
JeffPeterson1
Qrew Captain
3 months ago

Pipelines Jinja Expression for Day of Week

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

2 Replies

  • 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
    ------------------------------
    • JeffPeterson1's avatar
      JeffPeterson1
      Qrew Captain

      Thank you!  That's what I was after!



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