Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

date-time difference
New on LowEndTalk? Please Register and read our Community Rules.

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.


  • 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.

Sign In or Register to comment.