How to find time difference in minutes in SQL in Snowflake
Matthew Martinez
Here is a brief and simplified extract of my current dataset:
All my users currently have a start time and end time for various actions they complete. My time stamps are down to the milisecond. I however just want the time difference in minutes (not down to the milisecond).
Any idea how to achieve this in SQL in Snowflake?
Thanks!
1 Answer
Please check the DATEDIFF function:
For instance, the following returns 15.
SELECT DateDiff(minute, '2021-01-01 17:08:27.890'::timestamp, '2021-01-01 17:23:23.990'::timestamp) AS diff_minutes;