Templates and HH:MM:SS formatting

Playing with templates and trying to convert integer seconds to HH:MM:SS format.

Why does:

{{(3600) | timestamp_custom("%H:%M:%S")}}

equate to 02:00:00 and not 01:00:00?

and waht is the best way to convert seconds to HH:MM:SS format?


{{ 3600 | timestamp_custom("%H:%M:%S", 0) }}

See https://docs.python.org/3/library/time.html#time.strftime


Spot on. Thank you. Still not 100% sure why despite reading the docs

Am I right in thinking that the 0 denotes to return the time as gmtime() and 1 returns it as localtime()?

The time I entered - 3600 seconds - is not just 3600 seconds, because it is epoch time it is actually 3600 seconds past midnight on 1st Jan 1970 i.e. 1970-01-01 01:00:00 (?)

So the way i tried it was actually returning the time of 1970-01-01 01:00:00 but adjusted for my localtime by adding 1 hour?
And because i was only showing the HH:MM part I got the answer 02:00 instead?

I still haven’t got a clue how…

{{ 3600 | timestamp_custom("%H:%M:%S", 0) }}

…relates to the strftime() function in python

Thanks again