Convert Time HH:MM:SS to HH:MM

Hi,
I get a ramaining time from my washing maschine

sensor.waschmaschine_remaining_time

in the format HH:MM:SS, how can i convert this into only HH:MM ?
Regards
Jörg

Assuming that value is a string and not a datetime object you can slice it like this:

"{{ states('sensor.waschmaschine_remaining_time')[0:5] }}"

Note this does not round the seconds, it just truncates them. So 10:10:59 → 10:10, not 10:11.

1 Like