Re: LIBPQ - Mailing list pgsql-interfaces

From Tomasz Myrta
Subject Re: LIBPQ
Date
Msg-id 3F9CC4E3.702@klaster.net
Whole thread Raw
In response to LIBPQ  ("creid" <creid@netbcg.com>)
List pgsql-interfaces
Dnia 2003-10-23 22:01, Użytkownik creid napisał:

> Can anyone help me understand what it is I need to do to simply retrieve
> date and time columns into C variables that are readable.  All other columns
> are come across successfully but the date and time.  I have tried double to
> store the pg date and char[9] for time, among other typedef tries.  My
> psotgres columns are defined as: mytime time, mydate date.
> 
> Thanks
> C

1. char[9] is too short for displaying time. Default text representation 
of time is:
08:06:05.474477
You can:
- use longer variable char[16]
- format your time to have 08:06:05 only using to_char(...)
- change your columns from "time" to "time(0)"
2. char[9] is also too short for date. Default text representation for 
date (European format) is:
2003-10-27
You need char[11] for this.

Regards,
Tomasz Myrta



pgsql-interfaces by date:

Previous
From: "."@babolo.ru
Date:
Subject: Re: LIBPQ Question
Next
From: Tomasz Myrta
Date:
Subject: Re: LIBPQ Question