Moved to http://beyondrelational.com/blogs/jacob/archive/2008/10/02/how-to-find-differences-between-two-dates-in-hh-mm-ss-format.aspx
Why are you complicating it?It is as simple asselect d1,d2,convert(varchar(12),d1-d2,108) as diff from @t
Madhivanan,Your method may not work if the difference is more than 24 hours. If the difference is 26 hours, it returns just 2 hours.
Why are you complicating it?
ReplyDeleteIt is as simple as
select d1,d2,convert(varchar(12),d1-d2,108) as diff from @t
Madhivanan,
ReplyDeleteYour method may not work if the difference is more than 24 hours. If the difference is 26 hours, it returns just 2 hours.