Unable to get the difference between two dates and times
Hi, community,
I have been spinning my wheels with getting the differenthe ce between two dates and time.
The aim is to find the duration between the time a device is turned off and when that device is turned on.
I have two different services that output a datetime value. One service outputs the time the device is turned on and the second service outputs the time the device is switched off.
I then created a third service that calculates the difference between the two times.
Below is what I wrote in my third service:
var date1 = parseDate(onTimes_Input, " dd-MMM-YYYY HH:mm");
var date2 = parseDate(offTimes_Input, " dd-MMM-YYYY HH:mm");
let result= dateDifference(onTimes, offTimes);
when I execute the above, I get the following error:
Error executing service getDuration. Message :: Invalid format: "1661387400000" - See Script Error Log for more details.
Does anyone know what this could mean?
Best Regards
Jay_nisaa 🙂

