Time problem

Hello everyone,

if I

{{now()}}

type I get the current time, if I e.g.

{{states.light.keuken_bank.last_changed}}

I get the time that this entity was last changed.
What I suddenly notice is that these two differ by 2 hours.

How does this happen and how do I solve this?
Schermafbeelding 2025-06-26 153520

They are the same time. It is just that one is time zone aware and the other isn’t:

Schermafbeelding 2025-06-26 153520

EDIT: or more correctly one is local time the other is UTC as Drew points out below.

Try this:

{{ states.light.keuken_bank.last_changed|as_local }}
1 Like

Those are the same time…

now() returns time in your local time zone, HA stores all times as UTC.

Thank you very much. This solved my problem!! :+1: :sweat_smile:

I do not know what your problem or solution is, but beware that the local timezone might have daylight savings and UTC do not, so what is now +2 might be +1 or +3 in 6 months time.

HA have functions to convert time values that takes this into account.

|as_local will include DST in the conversion.