Date and Time Incorrect

Hey All, I just noticed I am having an issue with the date and time displayed in Lovelace. It shows the correct day and time but the date is stuck on January 1. I got the code for it from some thread and it worked well and I’m not sure when that stopped.

Here’s the way it looks:
image

Here’s what I have in my configuration.yaml:

#   Minimal configuration of the standard time and date sensor
  - platform: time_date
    display_options:
      - 'date_time_iso'
  # Build on the standard sensor to produce one that can be customized
  - platform: template
    sensors:
      time_formatted:
        friendly_name: "Date and time"
        value_template: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%A %B %-m, %I:%M %p') }}"
        icon_template: mdi:calendar-clock

Is anyone able to tell me why this is happening?

According to documentation, ‘%m’ is current month‘s number, so 1 is correct (currently).

Try %-d

1 Like

I stumbled on this thread (The EPIC Time Conversion and Manipulation Thread!) and saw the error and fixed it. Here’s a whole list on time and code if anyone needs it:
https://strftime.org/

Thank you for your time and help!

1 Like