select
sum(TotalSeconds) / 3600 as Hours,
(sum(TotalSeconds) % 3600) / 60 as Minutes,
sum(TotalSeconds) % 60 as Seconds
from
(
select ArrivalTime, DepartureTime, DateDiff(second, ArrivalTime, DepartureTime) as TotalSeconds
from SSR
where CustomerID = 10
) x
Thanks to this site for the heads up.
Jan 13 2008
T-SQL: Calculate Hours, Mins and Secs from StartTime and EndTime
Permanent link to this article: http://ramblinggeek.co.uk/2008/01/t-sql-calculate-hours-mins-and-secs-from-starttime-and-endtime/



2 comments
RaiulBaztepo
March 28, 2009 at 10:20 pm (UTC 0)
Hello!
Very Interesting post! Thank you for such interesting resource!
PS: Sorry for my bad english, I’v just started to learn this language
See you!
Your, Raiul Baztepo
PiterKokoniz
April 7, 2009 at 11:39 pm (UTC 0)
Hi !!!!
My name is Piter Kokoniz. Just want to tell, that your blog is really cool
And want to ask you: what was the reasson for you to start this blog?
Sorry for my bad english:)
Thank you:)
Piter Kokoniz, from Latvia