Calculating the Duration/Time elapsed between two form fields
For some questionaire/survey-type scenarios, you may wish to track the time it takes the user to fill out a Form, or maybe a section in the Form. This is done by storing a corresponding start and end date/time value, with these values being set when the user answers the first and last questions in the target Form or section. Once you have the start and end date/time values, you can then use a DATEDIFF() formula function to calculate the time elapsed in your desired unit of measure.
Step-by-Step Guide
We're going to use Hidden fields for this example since we don't want the user to see these stored values. You can also use Text or Date/Time fields if you wanted to display the start and finish date/time values to the user. We're also assuming you have at least two question fields - one at the start with data name of "myfirstquestion" and one at the end named "mylastquestion."
- Add a Hidden field with data name of "starttime" to the start of your Form design and a similar "endtime" Hidden field at the end of the Form.
On these Hidden fields, set the Dynamic Value to be as follows:
The final piece to this solution is to add one more field (Hidden, Text or Number) that has a Dynamic Value formula to calculate the difference between the finish and start date/time values. This field's formula would be: DATEDIFF(({{starthidden}}), {{finishhidden}}, 'SS')
- This will give you the difference in seconds between the start and end times.
- You can of course then divide this value by 60 as desired to get a minute value.
- If you wish to get the difference in minutes, hours etc, simply change the 'SS' parameter as needed.
Related Articles
Calculating the difference between two date/time fields
To calculate the difference between two date/time fields, create hidden fields that convert the time/date values gathered by time/date fields into a specific format using FORMAT-DATE. Then create another hidden or visible field with a dynamic value ...
120 Second Time Limit on Form Connectors
Every Connector job that runs on our servers is subject to a maximum run time limit of 120 seconds. This ensures that all customers receive equal and fair use of our server resources, maintains our infrastructure cost sustainability, and also ...
Date/Time Field Type
TABLE OF CONTENTS Basic Properties Data Name Title Text Hint Text Date/Time Type Working with Date & Time values in formula and bound Data Source scenarios How to get Date & Time values stored in your local time zone Layout & Styling Field Layout ...
Date and Time values in Form entries
Dates and times are captured as follows on form entries: Date only and Time only fields are captured in the local device time, but without any timezone information. As such, these are always displayed as the raw, local time values, without any time ...
What’s the difference between Form entry Completed time and Received time?
On the app side, the device's current date/time is used as the "Completed" date/time of the entry. This time is only as good as the device. So, if the device time is not accurate, then this will reflect on the Completed value as such. However, once ...