Skip to content

time date format

github-actions[bot] edited this page Nov 1, 2023 · 3 revisions

Introduction

Skill-level: low

In the ehmtxv2: section of your yaml, you can change the format that the date and time are displayed.

There are some helpful hints on the EspHome site but there are some undocumented ones, too. EspHome only uses a subset of strftime but there are still some good tricks available.

Date formats

Month.Day (02.28)

  date_format: "%m.%d"

Day.Month (28.02)

  date_format: "%d.%m"

Year.Month.Day (23.02.28)

  date_format: "%y.%m.%d"

Abbreviated Month and Date (Feb 08)

  date_format: "%b %d"

Abbreviated Day and Date (Tue 08)

  date_format: "%a %d"

Time formats

24-hour time (23:15)

  time_format: "%H:%M"

12-hour time with padded hour (01:25PM)

  time_format: "%I:%M%p"

12-hour time with unpadded hour (1:25PM)

  time_format: "%l:%M%p"

Localized Time and Date

Unfortunately, ESPHome does not seem capable of passing on localized time and date formats so that you can get time formats in your own language easily.

But you can still do it with a special function: time-date-replace.

Clone this wiki locally