Datetime comparison help

I have a DateTime item named LastVacuumDate with a saved value via jdbc persistence. I want to see if the time now is more than 24 hours after LastVacuumDate.

The rule would be something like below, but I can’t find any examples or work out the right syntax. Is anyone able to give me some pointers please?

rule "vacuum_walkies"
when
    Time cron "0 */20 * * * ?"
then 
  var DateTime TimeNow = now

   if (LastVacuumDate.state.plusHours(24) < TimeNow) {
	// more than 24 hours has passed, so do the vacuuming again
	VacuumMsg.postUpdate("the vacuum is going walkies...")
	// blah blah blah....
   }

(I want to do it in that way, because depending on some extra conditions [still to be added] the vacuum might wait for 48 hours instead of 24 hours)

So why not trigger the rule based on changes in those other conditions?

You need to cast the state to a DateTimeType and use the methods on now or the DateTimeType to do the comparison.

See

Thanks. That was exactly the sort of documentation I was looking for, but couldn’t find.

It is in work and that article will be added to the docs shortly.