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

Home -> Community -> Usenet -> c.d.o.server -> Re: How convert a unix time stamp (time_t) to Oracle Date datatype

Re: How convert a unix time stamp (time_t) to Oracle Date datatype

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 14 May 1998 01:38:00 GMT
Message-ID: <355a48e5.826438@192.86.155.100>


A copy of this was sent to "Aymeric Barantal" <abaranta_at_grolier.fr> (if that email address didn't require changing) On Wed, 13 May 1998 17:30:11 +0200, you wrote:

>Hello everyone,
>
>I want to convert a date express in second since 1st january of 1970 (time_t
>on Unix system) to an oracle date datatype.
>
>Is there a procedure to do that, or how can I do.
>
>Thank for your help.
>
>-- aymeric barantal -- Paris France
>

If you know your timezone, yes

...
time_t theTime;
varchar otime[50];

    time(&theTime);

    printf( "%s", ctime( &theTime ) );

    EXEC SQL SELECT to_char(

        new_time( to_date('01011970','ddmmyyyy') + 1/24/60/60 * :theTime,
        'GMT', 'EDT' ), 'dd-mon-yyyy hh24:mi:ss' )
        into :otime from dual;

...

Wed May 13 21:35:06 1998
13-may-1998 21:35:06

this will do it in the timezone EDT....  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Wed May 13 1998 - 20:38:00 CDT

Original text of this message

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