Template with strptime not working as expected, what am i doing wrong?

{{ strptime("9/17/2020, 4:00 PM", "%m/%d/%Y, %H:%M %p") }}

If I put that in the template editor, it evaluates to: 2020-09-17 04:00:00, I would expect it to evaluate to 2020-09-17 16:00:00, what am i doing wrong?

Thanks in advance

%H is hours for a 24-hour clock, thus 4 means 4 AM. You want %I which is for a 12-hour clock.

1 Like

Doh, thank you so much, i looked at that 20 times and never saw that.

Also, %p is ignored unless you use %I. It’s footnote 3 in the Python docs.

1 Like