A one liner solution for requirement to find out the date difference between two different dates in eScript:
function
Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
var Date1 = new
Date("12/22/2012");
var Date2 = new
Date("12/23/2012");
TheApplication().RaiseErrorText(
"Date1 =" +
Date1 +
"\n Date2 =
" + Date2 +
"\n Date
Difference in Days = " + (Date2.getTime() -
Date1.getTime())/(1000*60*60*24) +
"\n Date
Difference in Hours = " + (Date2.getTime() - Date1.getTime())/(1000*60*60)
+
"\n Date
Difference in Minutes = " + (Date2.getTime() - Date1.getTime())/(1000*60)
+
"\n Date
Difference in Seconds = " + (Date2.getTime() - Date1.getTime())/(1000));
return (CancelOperation);
}
Here below is the output: