Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> How to convert Oracle Database Date Type to C time_t
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 .....
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
![]() |
![]() |