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.
Author |
Topic |
missinglct
Yak Posting Veteran
75 Posts |
Posted - 2004-09-07 : 09:26:57
|
Hi all,I have a fieldname in SQL Server that stores number of seconds.Is there a script/command that can convert the number of seconds since 1/1/1970 to the "date" format? Ex: 1071541212 = 1/2/2004Thanks, |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-09-07 : 09:38:08
|
maybe something like this...but this gives me 2003-12-16declare @secs intset @secs = 1071541212select @secs/86400, dateadd(d, @secs/86400, '1.1.1970')hope it helps in some way...<edit> simpler: select dateadd(s, @secs, '1.1.1970')Go with the flow & have fun! Else fight the flow |
|
|
missinglct
Yak Posting Veteran
75 Posts |
Posted - 2004-09-07 : 11:29:28
|
quote: Originally posted by spirit1 maybe something like this...but this gives me 2003-12-16declare @secs intset @secs = 1071541212select @secs/86400, dateadd(d, @secs/86400, '1.1.1970')hope it helps in some way...<edit> simpler: select dateadd(s, @secs, '1.1.1970')Go with the flow & have fun! Else fight the flow
It helps. Thx.Here is another link I found useful in case someone else has the same question.http://www.techonthenet.com/access/functions/date/dateadd.htm |
|
|
|
|
|