November 5, 2002 at 12:30 pm
I have a time_t date in a character field (time in seconds since 1/1/1970) that I need
to tranlsate to use in a query. I know how to do it in Oracle with to_date but no idea in transact SQL. Does anyone have ideas/examples? How is a to_date done in SQLSERVER? Thanks Steven
November 5, 2002 at 2:03 pm
Think something like this might work for you:
declare @t_time char(100)
set @t_time =86400
select dateadd(ss,cast(@t_TIME AS INT),CAST('1/1/1970' AS DATETIME))
Gregory Larsen, DBA
If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
Gregory A. Larsen, MVP
November 5, 2002 at 2:35 pm
SELECT DATEADD(s, open_date, '1 / 1 / 1970') AS conv_dt FROM table_name
November 5, 2002 at 2:37 pm
THANKS!!!!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy