Can we get current date and calculate dates in a Jinja2 template?

Viewed 17

Context:

There is a framework that processes Jinja2 templates and creates AWS resources based on the JSON file generated from the Jinja2 templates. One field value in these templates is a date.

Problem:

I want a template which automagically calculates the future date 5 days from the current date in the following format: MMDDYYYY, preferably without passing any parameter to this template file.

I have no means to alter the processing framework, so i can only work with what template i feed in.

Questions:

Can any of these done in a Jinja2 template file?

  • get current date
  • calculate date which is 5 days later than a provided date in MMDDYYYY format
0 Answers
Related