SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 Difference between dates
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kishoremcp
Starting Member

India
39 Posts

Posted - 01/27/2014 :  04:32:43  Show Profile  Reply with Quote
Hi, I have two dates and i want the difference between those dates in Days:Hours:Minutes format.

please help.

2013-11-25 07:57:17.000
2014-01-17 11:39:58.000

Thanks in advance

Regards
Kishore

khtan
In (Som, Ni, Yak)

Singapore
17645 Posts

Posted - 01/27/2014 :  05:16:23  Show Profile  Reply with Quote
select	days	= mins / 60 / 24,
	hours	= (mins / 60) % 24,
	mins	= mins % 60,
	all_together	= convert(varchar(10), mins / 60 / 24)
			+ ':'
			+ convert(varchar(10), (mins / 60) % 24)
			+ ':'
			+ convert(varchar(10), mins % 60)
from
(
	select	mins = datediff(minute, '2013-11-25 07:57:17.000', '2014-01-17 11:39:58.000')
) d



KH
Time is always against us

Go to Top of Page

kishoremcp
Starting Member

India
39 Posts

Posted - 01/27/2014 :  06:42:03  Show Profile  Reply with Quote
Thanks.

Regards
Kishore
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000