How to calculate the duration of two date and time fields
-
caseySOFUAsked on May 17, 2022 at 02:17 PM
Hi! If we capture a start date and time and an end date and time, is there a way for the system to calculate the duration?
Thank you
Casey
-
RoseAnswered on May 17, 2022 at 04:34 PMJotform Support
Hi Casey,
I am currently working on your concern and need more time. I will get back to you shortly. Thank you.
-
RoseAnswered on May 17, 2022 at 05:41 PMJotform Support
Hi Casey,
To calculate the Date and Time duration, you need to add multiple Form Calculation widgets to your form. Then, add the following formula in each corresponding widget:
To get the raw difference between the 2 date and time fields:
To get the days difference:
To get the raw hours and minutes difference:
To get the hours difference:
To get the minutes difference:
Then, to summarize the total duration difference, you can add a Pharagraph element and add the unique name of the days, hours, and minutes field.
I also suggest that you hide the calculation widgets from the form view:
Here's the output:
Here's the clone form https://form.jotform.com/221366853182963, you may view it for demo purposes or you can also clone it.
Please give it a try and let us know if you need any help.