Measuring days between dates


I am trying to get the days between 2 dates. First date is coming from a button press with this and I write it to date time memory tag.

Second date is coming from another value changed tag script like below and in the same value changed script I want to calculate the days between first date and second one. I want to write this day difference to another memory tag."[.]…/…/Denemeler/BakimZamani"),ptime)

But I do get error like this

Error executing script.
Traceback (most recent call last):
File β€œtagevent:valueChanged”, line 4, in valueChanged
TypeError: daysBetween(): 2nd arg can’t be coerced to java.util.Date

I think my first date which was written on a date time tag in a different event script cant get read properly in the function. How can I get this to work?

Any help is much appreciated. returns a qualified value object. Use

1 Like