Difference between two dates

Need the difference between two dates? No problem! 😊

Use one of the following expressions. Trevor will calculate DATE_1 DATE_2 and return an interval. Make sure to replace DATE_1 and DATE_2 with the names of the columns holding your dates 😊

  • diff_in_seconds(DATE_1, DATE_2)
  • diff_in_days(DATE_1, DATE_2)
  • diff_in_weeks(DATE_1, DATE_2)
  • diff_in_months(DATE_1, DATE_2)
  • diff_in_years(DATE_1, DATE_2)

Note: you can also use now() which will return the present time as one of your dates.

Check it out:


Need to find the difference in minutes or hours?

Using the diff_in_seconds function and dividing the result by 60 will give you the answer in minutes:

diff_in_seconds(DATE_1, DATE_2)/60

Dividing that result by 60 again will give you the result in hours:

diff_in_seconds(DATE_1, DATE_2)/60/60

Like so:


Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request



Please sign in to leave a comment.