Auto-calculate elapsed time on your mobile forms
If your field crews need to record on-site time, they can enter start times and end times into their XForms field form, and XForms will automatically calculate elapsed time in seconds, minutes, hours, days, months, or years.
XF
XForms team
Jul 13, 2023

What its used for
If your field crews need to record total drive time, on-site time, and such, they can enter start times and end times into their XForms field form, and XForms will automatically calculate elapsed time. It can display elapsed time in seconds, minutes, hours, days, months, or years. And if you set this up in a table grid, you can even add up all the elapsed times and SUM them on the table footer.
How to set this up
This is done in the Form Template Designer using an expression named timeDiff. Steps:
- Open your form template
- Add time fields for start time and end time. Something like start_time and end_time
- Add a calculated field, and in the expression block of the calculated field, enter the timeDiff expression. Something like timeDiff({start_time}, {end_time}, ‘minutes’)
timeDiff expression settings
Definition:
Calculates the difference between start time value and end time value and returns the number based on requested unit
timeDiff({start-time-field}, {end-time-field}, ‘unit’)
- start-time-field: Date or Time field ID that contains start time
- end-time-field: Date or Time field ID that contains end time
- unit: one of the followings surrender by single quote
- seconds
- minutes
- hours
- days
- months
- years
Example:
timeDiff({start_time}, {end_time}, ‘hours’)
What it looks like in the Designer tool
Here’s what this will look like in the form template Designer. Note that the expression in the example below uses “minutes” as the display units, and then the whole thing is divided by 60. This could also have been done by just using “hours” as the units (without needing to divide by 60).

What it looks like on the mobile app
What you can do with this info when aggregated
If you set up your form template to SUM the elapsed time columns, you can pass this info to the reporting dashboard aggregation blocks, letting you view the total elapsed time over the selected period of time. With no more than 2 clicks, you can view the total elapsed time within seconds. In the xample below notice that the period of time selected was 30 days, and within those 30 days, a total of 181 forms were submitted into XForms, with a total drive time calculated at 408.75 hrs, and on-site time of 258 hours. Add both of these together and the field crew for this organization recorded 666.75 billable hours over a 1 month period of time.

Since its XForms, it can scale
The example above is from one of our customers, whose field crews use XForms to record hazardous and non-hazardous waste information at dozens of locations spread out over an entire state. Since they started using XForms about 18 months ago, their field crews have submitted over 6,000 forms into the platform for a single client of theirs.
Want to give XForms a try?
Click/tap the button below.
TRY XFORMS
Wanna give it a try, risk-free?
Build a form, capture a record offline and see it land in your dashboard.
XF
WRITTEN BY
XForms team
Keep reading
XForms Mobile
Sep 5, 2025
Tracking waste from cradle to grave using smartphones + AI
How do you ensure that the decarbonization end-product you are paying top dollar for originated from actual waste, and not virgin material?

XForms Mobile
Mar 2, 2025
Photos in table rows
Now you can take a photo within a table grid row, enabling you to take pictures of something specific and relevant to the information in that row of your table.

XForms Mobile
Jan 6, 2025
Photo metadata improvements
Photo metadata is now captured at the photo level instead of at the form level. This enables viewing of the geolocation of each photo taken, which could differ for each photo captured on the same form.
NEWSLETTER
Get new posts in your inbox
Product updates, field-tested how-tos and customer stories from XForms Mobile, Cx and XDocs.
New blog newsletter signup
One email when we publish. Unsubscribe anytime. or request a demo →

