ashleyde42
(AshleyDe42)
1
I am trying to get the Custom:Digital-clock card to show 24 hr time. I am having trouble reading the 12hr clock.
I have looked at coding examples, i can find 24hr clock but not the code to change the format. HA is in 24hr format.
Below is the simple code.
Any suggections
type: custom:digital-clock
dateFormat:
weekday: long
day: 2-digit
month: short
timeFormat:
hour: 2-digit
minute: 2-digit
Try this way. I added the timeZone:
to display it works correctly
type: custom:digital-clock
dateFormat:
weekday: long
day: 2-digit
month: long
timeFormat: HH:mm
timeZone: Asia/Baku
1 Like
ashleyde42
(AshleyDe42)
3
The trick is to delete the
hour: 2-digit
minute: 2-digit
Thank you
So basically what I just posted 
Your solution is not correct.
timeFormat: HH:mm:ss
is still required. Try another timeZone and delete
timeFormat:
Example of it not working via your Solution
Please provide advice for all scenarios
ashleyde42
(AshleyDe42)
5
Maybe to explain better. You need
Timeformat: HH:mm
but it will not work unless you delete
hour: 2-digit
minute: 2-digit
Plus timeZone is not required, it appears to pick that up from HA.
I added the time zone to show your explanation was incorrect and that
ashleyde42
(AshleyDe42)
7
This is a copy of my code and it works fine
- type: custom:digital-clock
dateFormat:
weekday: long
day: 2-digit
month: short
timeFormat: HH:mm
Yes, but the post you marked as the solution does not contain the correct code
You have to delete
hour: 2-digit
minute: 2-digit
AND ensure timeFormat:
is entered in this format timeFormat: HH:mm
That was my point and more information was required…
1 Like
Thank you for posting the correct code! 12 hour time was rough… I just copied and pasted then deleted time zone and the magic happened.
1 Like
Yep
Ooh RAH
Semper Fi to my people!
1 Like