# EPoch calculating datetime fractional difference

1058
1
09-14-2016 03:02 PM
Occasional Contributor

Trying to calculate the difference in time between an assignment start time and end time with the answer formatted in total hours and any fraction thereof.

So, if I worked 9/14/2016 13:00:00 till 9/14/2016 18:00:00 the 'Total Time Worked' equates to 5 hours.

Yet, if there was a fractional time 9/14/2016 13:00:00 till 9/14/2016 18:31:00 'Total Time Worked' equates to 5.52 hours

I have attached the XLSX form with my calculations.  The row starts at A11 through A14.  My current formula of:

int((\${end_date_time}-\${start_date_time}) div(1000*48*60))

cannot produce a fractional answer.  I have reworked it numerous times... This link shows it can be done, yet its beyond my ability.

http://www.epochconverter.com/date-difference

And looked at Dates and Times in Survey123 for ArcGIS as well...

1 Solution

Accepted Solutions
Occasional Contributor

I changed the formula from:

int((\${end_date_time}-\${start_date_time}) div(1000*48*60))

number((\${end_date_time}-\${start_date_time}) div(1000*60*60))

I even tested it across times greater than 24 hours.