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
 Convert number (seconds to datetime)

Author  Topic 

pazzy11
Posting Yak Master

145 Posts

Posted - 2007-11-26 : 05:55:06
Hi
I have a field (int) thats a value in seconds.

I need to add it to a datetime value to get a finish time ..

how can i convert it to datetime (baring in mind its seconds)
so far any conversion i do converts it to days...

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-11-26 : 05:57:32
quote:
"I have a field (int) thats a value in seconds."

value in seconds since when ?

use dateadd(), check out BOL for more information


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2007-11-26 : 06:00:08
depending on what your staring date is depends on what result you will get, but

select dateadd(s,64000,getdate())

will get you a date from the amount of seconds from today.
Go to Top of Page
   

- Advertisement -