Calculate difference in Seconds

Hi,
I tried to calculate the difference in seconds between the updates off an item.

Items:

Dimmer l_abseite <slider> (g_mysql)
DateTime l_abseite_update "Last Update [%1$td.%1$tm.%1$tY %1$tr]" (g_mysql)
DateTime l_abseite_time "Before Update [%1$td.%1$tm.%1$tY %1$tr]" (g_mysql)

Rules

I tried different version, but I can´t get it to work.
With this code I get the following error:

Rule 'Abseite Test Update': An error occoured during the script execution: null

Can someone please help me :slight_smile:

Confirm you have an Item called “datetimeitem”.
do you see nay of your logInfos in the log?

In the Log I see the first Loginfo:

Abseite Timestamp = 2017-01-17T09:10:31.510+0100

And then comes the Error…

Rule 'Abseite Test Update': An error occoured during the script execution: null

I have no datetimeitem, but the line with the datetime Item is commented with //

Sorry, I missed the “//” in the Picture!
If you see the first logInfo, the Problem must be between this logInfo and up to the next.
I gues it’s the next logInfo! Try "logInfo (“rules”, “alter Stand = " + alterstand.toString)”

I now tested from line to line…
The Error comes with this line:

Rule ‘Abseite Test Update’: An error occoured during the script execution: null

@opus Thanks for your help…

I now find another solution in a the old GoogleGroup that worked for me :slight_smile:

Don´t forget the

import org.joda.time.*