Re: [SQL] Date fields and libpq.... - Mailing list pgsql-sql

From Colin Dick
Subject Re: [SQL] Date fields and libpq....
Date
Msg-id Pine.LNX.3.96.980626132618.19665A-100000@ocis.ocis.net
Whole thread Raw
In response to Date fields and libpq....  (Colin Dick <cdick@mail.ocis.net>)
Responses Re: [SQL] Date fields and libpq....  (Kachun Lee <kachun@pathlink.com>)
List pgsql-sql
> Hi there,
>     I am doing a query on a date field and would like the answer in
> epoch time as apposed to a string.  I am using PQgetvalue(res,i,0) and
> can successfully get the string date as a response.  Is it possible to
> get an epoch result or do I have to write my own routine to parse the
> string into the tm struct so I can use mktime to get the epoch.  The
> latter solution seems quite a hassle and if anyone has a better
> solution, please let me know.  Thanks have a good weekend.

Ooops,
    Sorry, the field discussed above is cast as an abstime field not a
date...  If that makes a difference.  I have tried explicitly casting the
result from PQgetvalue(res,i,0) as an 'unsigned long' but now seem to be
getting the numerical value of the string instead of the epoch number
which I am looking for.  Still looking for answers if anyone has 'em..
Thanks again.

--
Colin Dick
On Call Internet Services
cdick@mail.ocis.net



pgsql-sql by date:

Previous
From: Colin Dick
Date:
Subject: Date fields and libpq....
Next
From: Kachun Lee
Date:
Subject: Re: [SQL] isnull function]