Painless script issue in date comparision

I have written a painless script to get the time difference between two date fields, but i'm not getting the correct answer.

default_date : 01-01-1970 00:00:00
result.taskslatable_duration.value : 01-01-1970 00:40:00

by calculating this i need to get time difference as 40 but i'm getting difference as 18479.

My script

def FirstDate = doc['default_date'].value.getMillis();
def SecondDate;
if (doc['result.taskslatable_duration.value'].size() == 0){
SecondDate = new Date().getTime();
} else {
SecondDate = doc['result.taskslatable_duration.value'].value.getMillis();
}
return (SecondDate-FirstDate) / (1000*60*60*24)

Not sure what wrong i'm doing here, any advice please.

Thanks
Gautham

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.