Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Converting UNIX time to GMT

Re: Converting UNIX time to GMT

From: Andy Triggs <andrew.triggs_at_businessobjects.com>
Date: 21 Aug 2002 08:52:57 -0700
Message-ID: <2b6e86d0.0208210752.46ca604e@posting.google.com>


Adding 1 to a date adds 1 day to it. There are 86400 seconds in a day, therefore adding 1/86400 to a date adds 1 second to it.

This should do the trick for you:

SELECT to_date('19700101', 'YYYYMMDD') + (<fieldname> / 86400) FROM <table>;

Regards, Andy

"Marc[uk]" <top_marcREMOVE_at_hotmail.com> wrote in message news:<1029925147.10683.0.nnrp-08.c2decc6c_at_news.demon.co.uk>...
> I have a requirement to display data from an Oracle 8.1.7 table which is
> populated by a 3rd party application. This application happens to store all
> of it's dates in the database as UNIX time (in seconds) but to make this
> meaningful in the report, i need to display it as GMT.
>
> I could do this in SQL Server with the line
>
> DATEADD (ss,<fieldname>,'19700101')
>
> but the closest function I found to this in Oracle is ADD_MONTHS.. but I
> assume by the name of the function, this works only in months whereas I need
> to convert from seconds.
>
> Any ideas?
>
> regards,
>
> Marc[uk]
Received on Wed Aug 21 2002 - 10:52:57 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US