Is there a way to show time in 12 hour format? #621
Grey-Lancaster
started this conversation in
General
Replies: 1 comment
|
put this in your yaml. file under sensors and use timepm not time. - platform: template
sensors:
timepm:
friendly_name: 'timepm'
value_template: >
{% set time = states('sensor.time') %}
{% set hour = time[:2]|int %}
{{ '{:02d}:{} {}'.format(hour if hour == 12 else hour % 12, time[3:5], 'PM' if hour>11 else 'AM') }} |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
yaml
All reactions