Calculation times with DateTime items

I tried it and while it works in one rule, the Designer gives me errors in another one.
So I found a simpler way for measuring the time between to events:

var long last_change    = now.millis

rule "duration"
when
    Item item_which_duration_you_want_to_measure changed
then
    //duration as Number in minutes
    var Number min    = ((now.millis - last_change) / 60000)
    ts_state_change    = now.millis
end
1 Like