Skip to content

datetime format and last changed [feature requests] #460

Description

@e1342

Please add the capability to

  1. format date/times
  2. reference "last changed"

I love what you are doing with this, and I'm looking forward to just how much more awesome this will be as it continues getting the attention from the community that it rightfully deserves! 😁

It is quite likely that I'm missing the obvious, but in case it isn't yet another user error:

I am attempting to update the display to show when an event last occurred. Since last_changed is a state and not an attribute, it doesn't appear to be an option in the UI. As a workaround, I created a datetime helper. I happen to use HA Real last changed HACS integration, but this same thing applies to the normal datetime helper.

However, the UI also doesn't seem to provide a way to format that helper's value, which results in the raw state being displayed, e.g. "2026-07-20T03:09:49+00:00". So I created a second helper that is converting to local time and formatting it as the specific HH:MM string I want, e.g. "15:31".

- sensor:
    name: cat_outside_real_last_changed_formatted
    state: '{{ as_local(as_datetime(states(''sensor.cat_outside_real_last_changed''))).strftime("%H:%M") }}'
  trigger:
    trigger: state
    entity_id: sensor.cat_outside_real_last_changed

I'm then able to use that final sensor value in the UI. I'm also guessing there are many ways my kludge could be made better, and I'd love to learn how to improve.

Again, thank you for your time and effort--it is appreciated even if there isn't interest or time to implement this enhancement request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions