New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
date-time difference
I have some datetime columns in a MSSQL db... start_time/ End_time.
Each containing values in format "2015-01-03 05:45:01"
I want to find the difference between the end time and start time. What is the best way to achieve the same? For eg:
End Time: "2015-01-03 05:45:01"
Start Time: "2015-01-03 01:35:01"
--> 4 hours 10 minutes (or likes)
There is a possibility that my start time and end time span multiple days.
I tried datediff, but, it does not give accurate results. Any help is appreciated.
Comments
Bump...
You did
SELECT DATEDIFF(minute, '2015-01-03 05:45:01', '2015-01-03 01:35:01')
? What kind of accuracy do you want? What do you mean by inaccurate?Maybe the columns are in different timezones, which might make it look incorrect.