Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Working-with-time-spans-and-durations

Author  Topic 

e.bar
Starting Member

25 Posts

Posted - 2008-12-18 : 12:14:36
On article "Working with Time Spans and Durations in SQL Server" (http://www.sqlteam.com/article/working-with-time-spans-and-durations-in-sql-server) there is the following:


select
sum(TotalSeconds) / 86400 as Days,
(sum(TotalSeconds) % 86400) / 3600 as Hours,
(sum(TotalSeconds) % 3600) / 60 as Minutes,
sum(TotalSeconds) % 60 as Seconds
from
(
select EventID, DateDiff(second, StartDate, EndDate) as TotalSeconds
from Events
)


I´d know how to add sum milliseconds into it.

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-12-18 : 13:34:18
There are 1000 ms in a second

Jim
Go to Top of Page
   

- Advertisement -