Hi,
So, these are 2 different timestamp formats, one with milliseconds, one without.
My assumption is that you know when you are retrieving the first, when the latter.
For
A =2018-10-25T07:18:30-0400
B= 2018-10-25T07:18:51-0400
The difference between A and B
import java.text.SimpleDateFormat;
import java.util.Date;
Date startTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX").parse(testExec.getStateValue("startTime"));
Date stopTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX").parse(testExec.getStateValue("stopTime"));
long seconds = (stopTime.getTime()-startTime.getTime())/1000;
testExec.setStateObject("untilDeliveredTime", seconds);
For
C =2018-10-25T11:18:29.535Z
D =2018-10-25T11:18:49.441Z
The difference between C and D
import java.text.SimpleDateFormat;
import java.util.Date;
Date startTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX").parse(testExec.getStateValue("startTime"));
Date stopTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX").parse(testExec.getStateValue("stopTime"));
long seconds = (stopTime.getTime()-startTime.getTime())/1000;
testExec.setStateObject("untilDeliveredTime", seconds);
Cheers,
Danny