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
 Long Number to Date

Author  Topic 

veromoran2002
Starting Member

2 Posts

Posted - 2007-06-07 : 15:17:28
Hi,
I am trying to convert a date from long number to a date format. Can someone please help me.

Example:
Database shows the following:
TimeCreated
1181224346

I would like to see the following
TimeCreated
06-07-2007

Thanks,

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2007-06-07 : 18:22:12
What does that number represent?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-07 : 19:05:04
Unix Time
It is the number of seconds since 1970-01-01. Just use dateadd()
select dateadd(second, 1181224346, '19700101')

Also see
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=66858&SearchTerms=unix,time


KH

Go to Top of Page

veromoran2002
Starting Member

2 Posts

Posted - 2007-06-08 : 14:39:27
Thanks!! :D I am going to try it.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-09 : 01:24:18
Also if you use receive dates that are express as integers, you can make use of this function
http://sqlteam.com/forums/topic.asp?TOPIC_ID=82164

Madhivanan

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

- Advertisement -