Subscribe To

Subscribe to SQL Server and XML by Email
Labels

Thursday, October 02, 2008

TSQL Lab 19 - How to find differences between two dates in HH:MM:SS format?

Moved to http://beyondrelational.com/blogs/jacob/archive/2008/10/02/how-to-find-differences-between-two-dates-in-hh-mm-ss-format.aspx

2 comments:

  1. Why are you complicating it?

    It is as simple as

    select d1,d2,convert(varchar(12),d1-d2,108) as diff from @t

    ReplyDelete
  2. 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.

    ReplyDelete

About Me
Jacob Sebastian
Tutorials
* XQuery Tutorials
My Links
SQL Server White Papers
SQL Server 2008
My Articles
XML Workshop RSS Feed
Contact me
Readers
Free Hit Counter
Web Site Hit Counters
SQL Server Bloggers
Blog Directories
blogarama - the blog directory Programming Blogs - BlogCatalog Blog Directory
 
Copyright Jacob Sebastian