Hi,
I’m having quite a lot of trouble converting an old OH2 rule for OH3.
What I wanna do is compare a date in a string to the date now.
So I read this post, the one I need should be #9 Get Epoch from String.
This is the part of the code that is not working
In the variable line I have the date string:
logInfo("Trash", "Date:" + line+"T00:00:00.000Z" )
val Number MyEpochFromString = new DateTime(line+"T00:00:00.000Z").millis
//The line above crashes with "An error occurred during the script execution: null in trash"
logInfo("Trash", "Date:" + line +"===>"+now.compareTo(MyEpochFromString))
if (now.compareTo(MyEpochFromString) <=0){
Restmuell.sendCommand(line)
}
The log info above the crash gives me:
Date:2021-01-19T00:00:00.000Z
Which looks correct to me. I don’t understand why the conversion line below crashes?
Can someone explain me where I’m going wrong?
Thanks and best regards
Daniel