-
EPOC? seconds since 1970 int conversion to date
I have an application that stores dates in what I believe is called EPOC, which is the seconds since Jan. 1st 1970. I am trying to write date related queries to the system and need to convert those dates into dates SQL server recognizes. This is on a 7.0 server and the current dates are stored as integers and are 10 spaces. DOes anyoner have experience writing queries to a system like this? Any help is appreciated. I've searched the site but came up blank...thanks
-
Here you go.
1032429807 is the number of seconds from 1970.
select dateadd(ss,1032429807,'1970-01-01 00:00:00:000')
-
create table timeduration (seconds int)
insert into timeduration select 1234567890
insert into timeduration select 1234567894
insert into timeduration select 1934567890
insert into timeduration select 1204567890
select dateadd(ss,seconds,'1970-01-01 00:00:00:000') from timeduration
-
Re: Thanks
THis is what I used which worked well, thanks for replying though.
UPDATE table SET INT_DATE = chgdate / 60 /60 /24 + 25567 from trkchg where int_date is null
UPDATE table SET REAL_DATE = CONVERT(DATETIME, INT_DATE) from table where real_date is null
The 25,567 is the days between 1/1/1900 and 1/1/1970
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|