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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Date Time

Author  Topic 

pradeep_iete
Yak Posting Veteran

84 Posts

Posted - 2008-06-07 : 03:44:55
Guys,
i want to represent the day difference in the format

' 1 days 15 hours'
How ?

I am unable to do .

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-07 : 03:50:22
SELECT CAST(DATEDIFF(hh,StartDate,EndDate)/24 AS varchar(5)) + ' days ' + CAST(DATEDIFF(hh,StartDate,EndDate)%24 AS varchar(5)) + ' hours'

Where StartDate and EndDate are your datevalues
Go to Top of Page

pradeep_iete
Yak Posting Veteran

84 Posts

Posted - 2008-06-07 : 04:09:04
I am very thankful to you for fast reply.
It indeed giving my antipatory results set
Go to Top of Page
   

- Advertisement -