Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Time Diffrence

Author  Topic 

Sanjay_Bakshi
Starting Member

14 Posts

Posted - 2008-07-18 : 13:49:45
Dear All,

I have two dates.
1.2008-07-18 12:58:59.990
2.2008-07-18 11:11 AM

now i have to get diffrence in HH:MM:SS

Sanjay

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-18 : 13:59:25
if its a datetime field just use

select cast(DATEDIFF(ss,StartDate,EndDate)/3600 as varchar(10)) + ':' + cast((DATEDIFF(ss,StartDate,EndDate)%3600)/60 as varchar(10)) + ':' +
cast((DATEDIFF(ss,StartDate,EndDate)%3600)%60 as varchar(10))
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-07-18 : 14:04:32
Duplicate: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=106750

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -