Compare LastUpdate in rules

Hi all,
In siteMap it’s possible to compare dateTimetype() with a value:
EX: valuecolor=[Weather_LastUpdate>1=“green”,Weather_LastUpdate>120=“orange” …
It’s good !
But how using this possibility in rules?
If (Weather_LastUpdate>120) is not correct and i can’t find the good syntax

Somebody had a solution?

Thanks a lot

The first thing is in your rules you need to refer to an Item’s state in your rules (it is an annoying inconsistency).

if(Weather_LastUpdate.state > 120) 

Second of all, in rules a DateTimeType I think you need to use the Date utilities in the rules:

if((Weather_LastUpdate as DateTimeType).calendar.before(now.MinusMinutes(120))

I’m sure there are other ways to do this but that is how I figured it out in my rules. Dealing with time can be a pain.

I try a second syntax it’s works perfect