TutorialDate and Time Calculations Gravity Forms

Do you want to calculate how many hours there are in between different Time Fields? Or days or years in between two different Date Fields? With the Gravity Forms Date Time Calculator Add-on from Gravity Perks you can easily do that.

Calculating seconds, minutes, hours in between Time Fields

The Add-on adds extra Merge Tags that are availabe for Number Field calculations. In this example we’ve added the End Time Merge Tag and substracted the Start Time Merge Tag.

Screenshot example of Enabling Calculation with End Time and Start Time as Merge Tags and setting the Date Calculation Unit.
Screenshot example of Enabling Calculation with End Time and Start Time as Merge Tags and setting the Date Calculation Unit.

Once you add a Time Field Merge Tag to your calculations, an extra dropdown comes available to pick how you want to show the result: Seconds, Minutes, Hours, Days, Weeks, Months, Years.

Screenshot of the Date Calculation Units available (Seconds, Minutes, Hours, Days, Weeks, Months, Years)
Screenshot of the Date Calculation Units available (Seconds, Minutes, Hours, Days, Weeks, Months, Years)

Calculating days, months, years in between Date Fields

With the same approach you can calculate the difference in between Gravity Forms Date Fields:

Screenshot example of Enabling Calculation with End Date and Start Date as Merge Tags and setting the Date Calculation Unit.
Screenshot example of Enabling Calculation with End Date and Start Date as Merge Tags and setting the Date Calculation Unit.

Rounding minutes, hours, days, months, years

With the Advanced Number Field Add-on you can easily round the calculation result.

Rounding the calculation field up to 5 decimal places and choosing a Rounding Method with Advanced Number Field Add-on.
Rounding the calculation field up to 5 decimal places and choosing a Rounding Method with Advanced Number Field Add-on.

You can also add a Custom Unit to the calculation Number Field (like hours, days):

Adding a Custom Unit behind the calculation result, like minutes, hours, days, weeks with the Advanced Number Field Add-on.
Adding a Custom Unit behind the calculation result, like minutes, hours, days, weeks with the Advanced Number Field Add-on.

Which will result in:

Example of using a Custom Unit 'hours' in the calculation field after the input.
Example of using a Custom Unit ‘hours’ in the calculation field after the input.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close