I have a DateTime array and I want to see the time elapsed in seconds from 1 element of my array with the current time.
I’m using a Gateway event script:
when test the script I get the error:
File “”, line 4, in TypeError: secondsBetween(): 2nd arg can’t be coerced to java.util.Date
any ideas why is not detecting the 2nd argument as date? if it is coming from my Date Time array…
Tag read gives you a qualified value. Update line 4 as follows to extract the tag value from the qualified value you placed into
Last variable in line 1.
dateerror = system.date.secondsBetween(datenow, Last.value)
In general, you can print the type of an object using:
This would then tell you that Last was in fact a QualifiedValue, as witman said. You could then look this up in the ignition api, or look up the function you’re using that returns that value (system.tag.read) in the user manual and it’ll tell you as well