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') }} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
yaml
Beta Was this translation helpful? Give feedback.
All reactions