Problem
Using the decimal-date-time on datetime questions to allow for computation of time difference between two datetime question one can always use the example below
round(((decimal-date-time(${DateTime_Return}))-(decimal-date-time(${DateTime_Departure})))*24,2)
Unfortunately, the operation only works on webforms to produce the exact number of hours while on ODK Collect this only returns the hours rounded off to days i.e. 24, 48, 72 etc.
An example of such a form is here Hours Calculated Between Dates v2.xlsx (18.9 KB)
Workaround
I had to change the logic for calculating the difference by splitting the datetime into two questions, date and time. And using absolute date difference and decimal-time difference between the times measured. This is the only approach that works on Collect.
round(((decimal-time(${Time_Return}))-(decimal-time(${Time_Departure})))*24,2)+round(((${Date_Return})-(${Date_Departure}))*24,2)
Hours Calculated Between Dates v3.xlsx (19.9 KB)
To reproduce
I suggest that you test the two forms I have uploaded on both web forms and collect
Query
- Is this a known bug with the latest collect
- Has this ever occurred in previous versions of collect
Stephane