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:
Comments
0 comments
Please sign in to leave a comment.