Forum Discussion

AidenPerez's avatar
Qrew Member
9 months ago

Creating Arbitrary Dates with Jinja

Hey folks, so I'm trying to find the first monday of the month in my pipeline, and I'm struggling to find a way to insert my own info to create a date to work with. Here is the beginning of my current attempt, with the problem laying on getting firstDay into date format...

{% set firstDay =, a.month, 1) %}

{% set weekday = firstDay.strftime("%w") %}

Would appreciate any help here with this, thanks in advance!

Aiden Perez

1 Reply

  • Hi, Aiden.  You didn't say what your final intended output is, so I'll just give some guidance on the first issue.

    FYI, this is the help page for working with dates and times:

    You want an absolute date, so:

    {% set firstDay = +, month=a.month, day=1) %}

    Be mindful that a.year and  a.month exist. 

    Hope that helps!

    Tim Wise