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
 General SQL Server Forums
 New to SQL Server Programming
 Datetime problem.

Author  Topic 

Asdzxc1986
Starting Member

14 Posts

Posted - 2009-12-17 : 09:56:02
Have a simple formula:
Time=Time1+Time2;
Time, Time1, Time2 datetime

I dont know how to summarize time without dates.

Example:
Time1=02.10.2009 1:25:01
Time2=07.11.2009 2:21:31
Time=1:25:01+2:21:31=03:46:32
Part with date not important for me.
?

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-12-17 : 10:31:41
select convert(char(10),dateadd(s,datediff(s,0,convert(datetime,('1900/01/01 '+'1:25:01')))
, convert(datetime,('1900/01/01 '+'2:21:31'))),108)


Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-18 : 01:04:03
or

select convert(char(10),dateadd(s,datediff(s,0,'1:25:01')
, '2:21:31'),108)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Asdzxc1986
Starting Member

14 Posts

Posted - 2009-12-18 : 03:49:13
Thanks
Go to Top of Page
   

- Advertisement -