In certain scenarios, when you collect 2 dates or 2 time frames (for example departure and arrival date and time in travel forms) you often need to calculate the date and time differences.
Can this be done with FormTitan? Are you serious?! of course it can.
Following is an example to show you how it's done:
Difference between date fields:
1- create a new blank form
2- Drag 2 date time elements and place them one below the other in the left part of your form.
Please make sure the format of both dates is MM/DD/YYYY. in order for this to work.
Name the top DateTime field: IN
Name the bottom DateTime field: OUT
3- Drag a calculated element below the other fields.
4- Change the label text of the Calculated to: TOTAL HOURS.
5- It’s settings window will automatically open - change it to “String mode” using the toggle above and turn on the “Function mode” checkbox.
6- Paste the following function in the editor:
Difference between time fields:
7- Drag 2 time elements and place them one below the other in the right part of your form.
Name the top one: time in
Name the bottom one: time out
8- Drag a calculated element below the other fields.
9- Change the label text of the Calculated to: total hours.
10- It’s settings window will automatically open - change it to “String mode” using the toggle above and turn on the “Function mode” checkbox.
11- Paste the following function in the editor:
12- Test your form:
Publish the form as URL
Enter the 2 date fields and 2 time fields and you will see the calculations roll in.