Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How to find time difference in minutes in SQL in Snowflake

Writer Matthew Martinez

Here is a brief and simplified extract of my current dataset:

enter image description here

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;

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.