Uptime format

I am getting my network devices’ uptime (device_class: timestamp) from the Ubiquity Unify intergration in this format:


Can anyone please help me to bring this into a better readable format like 20.04.2021 10:31 ?
I guess I have to to do this with a template sensor? But I have no clue how the formula would look like.

Thanks for the shortcut. This too complex to read for a little cosmetic issue, imho.

Man sorry for troubling you with all that new fangled learning stuff.

{{ states('sensor.uptime')|as_timestamp|timestamp_custom ('%d.%m.%Y %H:%M') }}}

Click the link indicated by the blue arrow on your system: takes you here:

1 Like

I really appreciate your help. I am willing to learn but that epic thread was a bit overwhealming. I am taking that string as a starting point to reproduce and learn.

It does not seem to work, though:

%H:%M not %H%:M. There was a typo in @nickrout’s suggestion, but realistically, you should try to understand the code enough to spot errors in people’s untested suggestions.

{{ states('sensor.last_boot')|as_timestamp()|timestamp_custom('%d.%m.%Y %H:%M') }}

I fixed it, but thanks for seeing my error.

1 Like

And sorry if I was a bit sarcastic.

I would like to check my own understanding here: That timestamp seems to be in the correct ISO format and the device class is timestamp, so HA will generally handle it properly (like using it on an entity card it won’t show milliseconds). Shouldn’t this be merely a case of presentation, meaning, how a datetime gets displayed is a browser localisation thing? Or am I stumbling across a larger conversation here (I’ve read the mega thread before but don’t recall something like this now)?