Gravity Perks – Date Time Calculator


What does it do?

This plugin adds the ability to use Date and Time fields in Gravity Forms calculations. Create complex and precise calculations based on any combination of Date, Time, and Number fields. Calculations can be used in any field that normally supports calculations, allowing you to build forms with flexible time-based pricing, track days and hours, determine the age of a customer based on their birth date, and any other calculation related to date and time.


  • Use Date and Time fields in your Gravity Forms’ calculations.
    Create robust date and time-based calculations right in your form editor.
  • Calculate duration between dates and times.
    Determine how many years, days, hours (and more!) are between any two Date or Time fields.
  • Supports every date/time unit you’ll need.
    Get your results in years, months, weeks, days, hours, minutes and seconds.
  • Calculate the user’s age and apply age-specific customizations.
    Prevent underage submissions, configure child/senior pricing, determine customer’s age for past and future milestones.
  • Count weekdays and weekend days between two dates.
    Only count the days that are important for your calculation.
  • Duration-based pricing.
    Combine with Gravity Forms Calculated Product fields to create dynamic pricing based on user selected dates/times.
  • Automatic updates.
    Get updates and the latest features right in your dashboard.
  • Awesome support.
    We’re here to help! And we mean it.


  1. How do I enable this functionality?
  2. Feature Details
    1. Field Settings
      1. Merge Tags
      2. Rounding
      3. Date Calculation Unit
    2. Date Based Calculations
    3. Counting Weekdays or Weekend Days
    4. Time Based Calculations
    5. Combined Calculations
    6. User Modified Calculations
    7. Calculating Age
    8. Current Date and Time Calculations
  3. Integrations
    1. Gravity Forms Advanced Calculations
  4. Translations
  5. FAQs
    1. Can I disable autocomplete for Date fields?
    2. How do I calculate between Daylight Savings and Standard Times?
  6. Known Limitations
  7. Hooks

How do I enable this functionality?

After installing and activating Gravity Forms Date Time Calculator, calculations based on Date and Time fields become available in Number fields within your form. Let’s step through that process.

Gravity Perks – Date Time Calculator Add two Date or Time fields to your form.
Gravity Perks – Date Time Calculator Add a Number field to your form and check Enable Calculation.
Gravity Perks – Date Time Calculator Insert Date or Time field merge tags into your calculation.

Now that you know how to create Date-based calculations, let’s dig into the specifics of what Date Time Calculator can do.

Feature Details

Field Settings

Gravity Perks – Date Time Calculator
Merge Tags

In fields that support calculations, like Number and Product fields, the Insert Merge Tag drop down is automatically populated with any Date or Time fields in the form.


Date Time Calculator fully supports Gravity Forms Rounding. If you are looking to round by increments, we have an awesome snippet called Rounding by Increments with Gravity Forms. Super helpful when trying to round up, down or setting a min/max.

Date Calculation Unit

Set the calculation unit for the current field. Use this to change the value output on the front end. This also affects how things are calculated on the back end, which is especially useful when working with modifier fields.

Date Based Calculations

Dates are calculated just like any Number. Insert the merge tags for the Date fields into the Formula box with mathematical operators and it will take care of the rest. To count the number of days between two Date fields, simply subtract one field from the other.

Gravity Perks – Date Time CalculatorThis field will show how many days are between these two date fields
 Always subtract the oldest date from the most recent date or you might end up with a negative number due to the way Date Time Calculator processes date fields.

Counting Weekdays or Weekend Days

Use the {weekdays:} and {weekendDays:} merge tags to count the number of weekdays or weekend days between two dates. Use the following syntax:


For example, if we have two date fields labeled “Start Date” and “End Date” with Field IDs of 1 and 2 respectively, use the following merge tag to count the number of weekdays between the two dates.

{weekdays:{Start Date:1},{End Date:2}}

 Weekday and weekend day counts include the first day. To exclude it, simply add a -1 to your calculation after the merge tag.

Time Based Calculations

Calculations between Time fields behaves mostly the same as Date fields. Insert the merge tags into a Number field and Date Time Calculator will perform any mathematical operations you tell it to.

Gravity Perks – Date Time CalculatorThis calculation will show the number of hours between the user-specified times.

Combined Calculations

You can combine Date and Time fields to create combined calculations. This lets you create more precise calculations all the way down to the second. In the following example, we’ll count the number of hours between two dates with specific times.

  1. Start by adding two Date and two Time fields to your form. Name them Start Date, End Date, Start Time, and End Time.
  2. Add a Number field to your form, Enable Calculation, and try to remember your mathematical order of operations when entering your formula.
    Gravity Perks – Date Time Calculator
  3. Set the Date Calculation Unit to “Hours”.

User Modified Calculations

Date Time Calculator supports user modified date calculations by including additional Number fields in the calculation. In the following example, we’ll count the number of days between two dates and add a user-defined amount of days to the result.

  1. Start with two Date fields and a Number field in your form, matching the same setup in the Date Based Calculation above.
  2. Add an additional Number field to the form. Name it Modifier.
  3. Add the merge tag for the Modifier field to the calculation in your result field.

    {Date:2} - {Date:1} + {Modifier:4}

On the front end, the user can select the Start and End Dates, input a modifier in the Modifier field, and the result will add the number of days in the Modifier field to the result.

Gravity Perks – Date Time Calculator
 To automatically modify dates without user input, simply add the number directly in the calculation.

Calculating Age

Calculating age is simple with Date Time Calculator. To calculate age from a Date field, add the :age merge tag modifier to the desired Date field merge tag using the following template:


For example, for a field labeled “Date of Birth” with a field ID of “1”, the merge tag is written like this:

{Date of Birth:1:age}

Current Date and Time Calculations

Use the {today} merge tag to make calculations based on the current date. For example, to count the number of days between now and a user-inputted date, use the following syntax:

{Date:1} - {today}

The same can be done with Time fields and the {now} merge tag.

{Time:1} - {now}

Both of these merge tags are automatically recalculated on submission to maintain accuracy. If your form relies on up-to-the-second time, we have you covered.


Gravity Forms Advanced Calculations

Date Time Calculator integrates seamlessly with Gravity Forms Advanced Calculations. GP Advanced Calculations allows for complex functions, formulas, conditionals, and more directly in your Number and Product fields. These two perks can also be used together to calculate durations.

There are no reviews yet.

Write a review

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.