How do I calculate the difference between two dates?

EZ Exporter supports multiple functions that can be used in the Calculated Fields section of the Data Settings to figure out the difference in days, hours, minutes, or seconds between two dates.

  • days_diff(end_date, start_date)
  • hours_diff(end_date, start_date)
  • minutes_diff(end_date, start_date)
  • seconds_diff(end_date, start_date)

For example, to get the number of days between the "updated" and "created" dates, you can use this formula:

days_diff(to_datetime({{ updated_at }}), to_datetime({{ created_at }}))

The to_datetime() function simply converts the data to a datetime object so we can properly evaluate the function.

You can also do something like this:

days_diff(to_datetime("2017-10-31"), to_datetime({{ created_at }}))

The time can be included as well. The formula works the same way for hours_diff(), minutes_diff(), and seconds_diff().


App: EZ Exporter

Tags: advanced features, functions