Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning DATEDIFF Value As hh:mm:ss
Message
From
21/03/2002 20:41:55
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00635803
Message ID:
00635827
Views:
16
>It's easier.
>declare @dtStart datetime
>declare @dtEnd datetime
>set @dtstart = '01/01/2002 9:00:00'
>set @dtEnd = '01/03/2002 8:09:00'
>SELECT CAST(DATEDIFF(second, @dtStart, @dtEnd)*1.00/3600 AS numeric(10,2))
>
>-- or
>SELECT CAST(DATEDIFF(hh, @dtStart, @dtEnd) AS varchar(4) ) +
> RIGHT(CONVERT(char(8), DATEADD(second, DATEDIFF(second, @dtStart, @dtEnd), '20020101'), 8),6)

Excellent! Wonderful! Fast! You did it both ways!

Thank you so much.
Previous
Reply
Map
View

Click here to load this message in the networking platform