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 2000 Forums
 Transact-SQL (2000)
 Unix Date Conversion

Author  Topic 

poser
Posting Yak Master

124 Posts

Posted - 2008-01-23 : 18:41:28
Is it possible to write a select statment that converts a unix date.

I have a table called DATES with two column

Assigned Resolved
911341436 911843687

Can you SELECT Assigned from Dates
to return this format:
Tuesday, November 17, 1998 2:23:56 PM

Thanks for any and all help!
R/P

jdaman
Constraint Violating Yak Guru

354 Posts

Posted - 2008-01-23 : 18:51:23
declare @a int
select @a = 911341436

select convert(varchar, dateadd(second, @a, '19700101'), 109)
Go to Top of Page

poser
Posting Yak Master

124 Posts

Posted - 2008-01-23 : 19:02:15
The problem is I have over a thousand records to convert and I was looking for a way to return all of them in the new format.
Is this possible?
Thanks for your help.
R/P
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-01-23 : 20:17:31
[code]
select dateadd(second, yourcolumn, '19700101') as new_datetime_col
from yourtable
[/code]

Do the formating of the required date/time format in your front end application


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

Go to Top of Page
   

- Advertisement -