Hi friends...
I have a postgres table like this:
CREATE TABLE "test" ( "timedate" timestamp NOT NULL);
INSERT INTO test VALUES ('25/12/2001');
INSERT INTO test VALUES ('31/12/2001');
INSERT INTO test VALUES ('31/12/2001 23:59:59');
and this source code:
GdaRecordset *rs = gda_recordset_new ();
time_t t;
gda_recordset_set_connection (rs, cnc);
gda_recordset_open_txt (rs, "select * from test",
GDA_OPEN_FWDONLY, GDA_LOCK_PESSIMISTIC, 0);
gda_recordset_move_first (rs);
while (!gda_recordset_eof (rs))
{
t = gda_field_get_timestamp_value (gda_recordset_field_idx (rs, 0));
g_print ("timedate: %s\n",str_timedate_from_time_t(t));
gda_recordset_move_next(rs);
}
char *
str_timedate_from_time_t (time_t t)
{
struct tm *tm;
static char isotime [40];
tm = localtime (&t);
strftime (isotime, sizeof (isotime)-1, "%d/%m/%Y-%H:%M:%S", tm);
return isotime;
}lmail.com.ar
the output is:
timedate: 31/12/1969-20:59:59
timedate: 31/12/1969-20:59:59
timedate: 31/12/1969-20:59:59
with a dbgrid:
( snapshot.jpg )
what is the problem ???
I hope your help !!
Thanks
Juan Andres
Attachment:
snapshot.png
Description: PNG image