as_timestamp
is working with script posted.
I cant recall right now where I read that, i read many topics without finding working template for my sensor/helper, but it was about using time&date instead of now()
, because that updating like 123 said.
Tried this and it looks like working, it came up with 0 days (because I shutdown/reboot my system today)
{{ (now() - states('sensor.system_monitor_viimeinen_kaynnistys') | as_datetime).days }}
But this returned unavailable
{{ (now() - strptime(states('sensor.system_monitor_viimeinen_kaynnistys'), "%B %d, %Y at %H:%M")|as_local).days }}
That sensor.system_monitor_viimeinen_kaynnistys
is giving date as May 24, 2024 at 17:11