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
 Old Forums
 CLOSED - General SQL Server
 Date as Int ...

Author  Topic 

lassew
Starting Member

5 Posts

Posted - 2005-06-03 : 08:41:15
I'm trying to analyse a SQL Server 8 database where date is stored as Int, Null. Is it possible to convert it to a dateformat?

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-06-03 : 08:42:49
what kind of int?? what does it look like?

Corey

Secret Service Agent: Mr. President, you're urinating on me.
President Lyndon Johnson: I know I am. It's my prerogative.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-06-03 : 08:43:26
how is it stored can you give an example?

select covert(datetime, YourDateColumn)
from YourTableAme

Go with the flow & have fun! Else fight the flow
Go to Top of Page

lassew
Starting Member

5 Posts

Posted - 2005-06-03 : 08:47:45
Some exemples of dok_dt

1046440184
1046440184
1046440184
1047027417
1047033499
1047034683
1047034683
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-03 : 08:51:38
What output do you expect from those?

Madhivanan

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

X002548
Not Just a Number

15586 Posts

Posted - 2005-06-03 : 09:51:04
Good, another date question

Please follow the direction in the link below.



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2005-06-03 : 10:21:01
Wild guess: it's seconds from UNIX epoch.

DATEADD(s, dok_dt, '19700101 00:00:00')

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-06-03 : 10:36:05
Good lord.....not again...

What the hell don't you know?

Gotta blog this as well...


DECLARE @dok_dt int
SELECT @dok_dt = 1047034683
SELECT DATEADD(s, @dok_dt, '19700101 00:00:00')




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -