|
mani_1234
Starting Member
India
24 Posts |
Posted - 10/05/2012 : 00:57:57
|
create table #t ( fromdate datetime , todate datetime ) insert #t select '2011-03-06 13:05:00','2011-03-06 20:05:00 ' union all select '2011-03-06 13:05:00','2011-03-06 20:06:00 ' union all select '2011-03-06 13:05:00','2011-03-07 16:06:00 ' union all select '2011-03-06 09:00:00','2011-03-06 18:15:00 ' select * from #t select convert(varchar(5),datediff(HOUR ,fromdate,todate)) + ' hour '+ convert(Varchar(5),DATEDIFF (Minute,fromdate,todate)%60) +' Minute ' + convert(Varchar(5),DATEDIFF (SECOND ,fromdate,todate)%60) +' Second ' from #t |
 |
|