{{ state_attr('binary_sensor.alert', 'updated')| as_datetime(0) }}
returns:
2025-02-12 11:53:50-05:00
the result reflects the correct timezone (local - EST) and I want to get rid of the timezone offset string, ie: “-05:00”
Since these filters are not implemented
| datetimeformat('%Y-%m-%d %H:%M:%S')
| strftime('%Y-%m-%d %H:%M:%S')
I decided to convert to string and truncate:
{{ state_attr('binary_sensor.alert', 'updated')| as_datetime(0) | string | truncate(16, true, '') }}
which works:
2025-02-12 11:58
But is there another way to do this while keeping it under a datetime format?
If I convert to timestamp, I get UTC and end up with issues managing DST…
Thanks!