Good resource to learn jinja?

Trying to format date and time and conducted some research but to me jinja is so foreign compared to just python or javascript or C++.

Can anyone help me find:

  • a good learning site or video for basic jinja (I’m thinking like W3 schools etc)
  • how do I use the datetime.strftime?

I can help with the second question:

Thanks! Upon a further Google I found the strftime.org page but this thread is much more comprehensive.

But it basically formats like python does.

ehh kinda I mean i just did it in python on how i want the message of my notification to be and this is the output. Granted i would obviously import specifically datetime from the module datetime which would greatly simplify what i have below, but this is the gist and I don’t see the syntax the same using jinja…

print("Garage remained opened " + datetime.datetime.now().strftime("%I:%M %p %b %d"))

Garage remained opened 11:49 PM Oct 01

Ok got it figured out now!

The garage was {{ states('cover.garage') }} on {{ now().strftime("%I:%M %p %b %d") }}
renders:
The garage was closed on 11:53 PM Oct 01

Thanks!

In answer to your original question, I assume you have looked in the documentation, but if not https://jinja.palletsprojects.com/en/master/templates/ and https://www.home-assistant.io/docs/configuration/templating/

Sorry if I am preaching to the converted, but some people just don’t look in the docs :slight_smile:

Actually i did the time wrong, had to change it a bit, but got it working now like this:

{{ as_local(states.cover.garage.last_changed).strftime("%I:%M %p %b %d") }}