Nothing in particular.
I’m a beginner.
I’m starting to study the use of dates and times.
I was able to work on dates (custom formats) and wanted to do the same thing with times (eg 03:05 PM ‘% I:% M% p’).
I must start from date_time_iso
Nothing in particular.
I’m a beginner.
I’m starting to study the use of dates and times.
I was able to work on dates (custom formats) and wanted to do the same thing with times (eg 03:05 PM ‘% I:% M% p’).
I must start from date_time_iso
Well, if you want to take HH:MM:SS format and use it in tempaltes, the best way to do that is with today_at
It appends the date to the time you put in quotes (or from a sensor). and then you can use that however you want.
{{ today_at("10:00") }}
or
{{ today_at("10:00:00") }}
and then to format it
{{ today_at("10:00:00").sfrttime("%I:% M %p") }}
and from your sensor
{{ today_at(states('sensor.time')).sfrttime("%I:%M %p") }}
however, keep in mind, you can just use now() to do this without any extra sensors
{{ now().stfttime("%I:%M %p") }}
Thanks Petro for your help