Compare dates and times in Zaps

Available on plans:

Free

Pro

Team

Enterprise

Formatter’s Date/Time action allows you to calculate the time difference between two dates and time. You can compare the start and end dates to find the duration in days, hours, minutes, and seconds. 

You can use this to accomplish tasks such as:

  • Identifying overdue tasks or deadlines.
  • Booking systems availability check.
  • Service level agreement (SLA) monitoring.

1. Add a Formatter step

  • In the Zap editor, click the Action step. A dialog box will open.
  • In the search box, search for and select Formatter. The right sidebar will open to the Setup tab.
  • Click the Action event dropdown menu and select Date / Time.
  • Click Continue to continue to the Configure tab.

2. Set up your transform

  • Click the Transform field dropdown menu and select Compare Dates.
  • In the Start Date field, manually enter the date/time or map the field from the previous step.
  • In the End Date field, manually enter the date/time or map the field from the previous step. 
  • (Optional) You can explicitly set the date and time format for your Start and End Date fields to ensure Zapier interprets it correctly. 
  • Click Continue to continue to the Test tab.
ratingStar icon Tip

To compare a date against today's date, enter {{zap_meta_human_now}} into the field. Learn more about using custom timestamps in Zaps.

miscEye icon Note

For the Start Date and End Date fields, Formatter will assume:

  • The date is today is no date is entered (only a time is entered).
  • The time is midnight if no time is entered (only a date is entered).

3. Test your action

Test your action to verify it is calculating the difference between the date and time correctly.

  • Click Test step.
  • The Data out tab will display the date comparison.

The Output Dates Swapped field is:

  • False if the end date/time is after the start date/time.
  • True if the end date/time is before the start date/time.

The Output Same Dates field only compares dates, not times. It is:

  • False if the date does not exactly match.
  • True if the date exactly matches.

Once you’ve set up your Formatter action, you can use the results in further actions in your Zap.

ratingStar icon Tip

You can add a filter or paths to your Zap based on the date and time to set time-based conditions or branching logic.

Was this article helpful?
0 out of 0 found this helpful