Monthly Archives: January 2008

T-SQL: Calculate Hours, Mins and Secs from StartTime and EndTime

select   sum(TotalSeconds) / 3600 as Hours,   (sum(TotalSeconds) % 3600) / 60 as Minutes,   sum(TotalSeconds) % 60 as Secondsfrom(select ArrivalTime, DepartureTime, DateDiff(second, ArrivalTime, DepartureTime) as TotalSeconds from SSRwhere CustomerID = 10) xThanks to this site for the heads … Continue reading

Posted in Programming, SQL | 2 Comments