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 -> How to convert Oracle Database Date Type to C time_t

How to convert Oracle Database Date Type to C time_t

From: <ellen111_at_my-deja.com>
Date: Thu, 19 Aug 1999 10:52:23 GMT
Message-ID: <7pgnl5$kgj$1@nnrp1.deja.com>


Hi, when I try to retrieve date from oracle database, and convert it to time_t type, I have some questions.

the way now I used is:
select date into char from oracle database, then convert char to time_t(I wrote a function by myself). and it is not very efficient.

I was told that there is a way to convert them directly: select date into time_t(? or long, because there is no time_t date type in pro*C), following is my code:

EXEC SQL BEGIN DECLARE SECTION;
time_t t; //this got an error when precompile long t; //?
EXEC SQL END DECLARE SECTION;
....
EXEC SQL SELECT ((new_time(date,'EST','GMT') -

                to_date('01-jan-1970','dd-mon-yyyy'))*24*60*60)
         INTO :t
         FROM .....

printf("time=%d\n",t);

but it returns 0 to me...
any advises please!

Ellen

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Thu Aug 19 1999 - 05:52:23 CDT

Original text of this message

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