Friday, September 23, 2016 2:09:00 PM
To calculate the number of hours based on the difference between two Date fields:
- Add two Date fields to your form, labelled "Start Date" and "End Date".
- Add two Time fields to your form, labelled "Start Time" and "End Time".
- Add a Calculation field labelled Total Hours, and insert the following expression:
=(Math.Round((EndDate.AddMinutes(EndTime.Minute + (EndTime.Hour * 60)) - StartDate.AddMinutes(StartTime.Minute + (StartTime.Hour * 60))).TotalMinutes / 15) / 4)
- Now, when the user inputs their start and end times, the Calculation field will automatically display the total number of hours in 15 minute increments: