6

How do I convert a string to a datetime object inside of a jinja2 template?

I want to do something like the following, but strptime is not recognized.

{% set dtime=strptime(passedintime, '%H:%M:%S') %}

I have the jinja2-time.TimeExtension enabled in the environment. I have very limited ability to modify a string outside of the template. I basically only have access to the template itself.

cizario
  • 3,995
  • 3
  • 13
  • 27
speroni1
  • 63
  • 1
  • 4

0 Answers0