Format time to only HH:MM:SS and not HH:MM:SS.uuuuuu

I have this solution that is working: How to calculate duration a binary sensor is currently in the on state - #2 by PeteRage

However the time comes out as HH:MM:SS.uuuuuu. Is there a way to remove the .uuuuuu from being displayed?

I just want “0:12:02” and remove the “.323321”

I’ve tried adding timestamp_custom(’%H:%M:%S’) to the template, but that doesn’t seem to work.

You can use replace() to zero out the microseconds:

{{ now().replace(microsecond=0) - states.binary_sensor.esp_pump_ejector_pump_status.last_changed.replace(microsecond=0) }}

Thanks exactly what I needed.