If you are wanting to perform a calculation between two date fields there are several ways to accomplish this:
1. Define a Number variable and use the DateDiff function
2. Create a script Calculation
For the purposes of this article we are going to use the Form Variable method.
1. Add Date Fields to Your Form
The first step is to add two date fields to your form as shown below:
2. Add a Form Level Calculation Variable
Next, click the Rules button to add a new variable to your form. You will be presented with the following screen:
Click the Calculations/Variables tab, then click the Add Variable button as shown below:
Select Number as the variable type and Click the Date Diff in Days function in the Function's list.
Next, specify the two date fields that you want to be included in your calculation:
Name your Variable and click Save.
3. Add a Variable Display Field to Your Form
Next, add a Variable Display field to your form. This will allow you to see the calculated difference in the number of days on your form:
Select your new variable in the Variable list as shown below:
4. Save and Publish Your Form
Finally, Save and Publish your form and open it up on your mobile device. Enter two different dates and you will see your new variable automatically calculate the difference between the two dates: