Format date/time variable in Jinja2 template

I figured it out. I changed the template to the following:

{{ (user.pwdexp|to_datetime(‘%Y%m%d%H%M%SZ’)).strftime(‘%m/%d/%Y %H:%M:%S’) }}

So the to_datetime matches the data format, and strftime prints that how I need it. All good now.

Thanks,
Harry

2 Likes