[ORACLE] Timestamp to unix format and viceversa
From: GePs <spammaquesta_at_email.it>
Date: 7 Nov 2005 09:25:39 -0800
Message-ID: <1131384339.810865.301700_at_g44g2000cwa.googlegroups.com>
Hi everyone!
Im working with OCI and C language, and I need to convert a values fetched from a db table in a unix timestamp (seconds passed by january first 1970).
Date: 7 Nov 2005 09:25:39 -0800
Message-ID: <1131384339.810865.301700_at_g44g2000cwa.googlegroups.com>
Hi everyone!
Im working with OCI and C language, and I need to convert a values fetched from a db table in a unix timestamp (seconds passed by january first 1970).
The table is like this
create table test(.... ts timestamp not null...);
and the code to define the output variable (for a select statement) is the following, where time is an OCIDateTime variable
OCIDefineByPos(stmth, &defineh, errh, pos, (dvoid *) time, 0, SQLT_ODT,
(dvoid *) 0, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT);
once I have initialized "time", how can I convert his content to unix
timestamp?
And viceversa, how can I put an int value rapresenting a unix timestamp
in an OCIDateTime variable, and then insert it correctly inside mt
table?
thank you!
GePs
Received on Mon Nov 07 2005 - 18:25:39 CET