Today i got one requirement to convert date difference using Hours minutes and seconds. Using below query we can able do that.
Example code:
declare @StartDate datetime declare @EndDate datetime set @startDate='12/12/2012 08:40:18.000' set @EndDate='12/14/2012 09:52:48.000' select convert(varchar(5),DateDiff(s, @startDate, @EndDate)/3600)+':'+convert(varchar(5),DateDiff(s, @startDate, @EndDate)%3600/60)+':'+convert(varchar(5),(DateDiff(s, @startDate, @EndDate)%60)) as [hh:mm:ss]
Output of the above query is
49:12:30
Post a Comment
Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.