Re: any way to convert date via libpq?

From: "Tena Sakai" <tsakai(at)gallo(dot)ucsf(dot)edu>
To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
Cc: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: any way to convert date via libpq?
Date: 2009-03-11 06:07:33
Message-ID: FE44E0D7EAD2ED4BB2165071DB8E328C0378F7D5@egcrc-ex01.egcrc.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Scott,

Many thanks for your reply.
I just tried:
select extract (epoch from timestamp with time zone '2008-04-04 20:00:0.0');
and got:
1207364400
which is great!

I suppose there is no problem running this query
via PGexec() in a C program? Something like:
result = PGexec (conn, "FETCH ALL from somePort");

Many thanks.

Regards,

Tena Sakai
tsakai(at)gallo(dot)ucsf(dot)edu

-----Original Message-----
From: Scott Marlowe [mailto:scott(dot)marlowe(at)gmail(dot)com]
Sent: Tue 3/10/2009 9:55 PM
To: Tena Sakai
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] any way to convert date via libpq?

On Tue, Mar 10, 2009 at 8:43 PM, Tena Sakai <tsakai(at)gallo(dot)ucsf(dot)edu> wrote:
> Hi Everybody,
>
> I have a C program to read a postgres table.  One of
> the columns of this table is defined as:
>
>   timestamp without time zone
>
> Is there any routine/function that I can use to convert
> this field/column value into unix/linux style date for
> comparison purpose?

select extract('epoch' from timestampfield) ;

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Marlowe 2009-03-11 06:15:14 Re: any way to convert date via libpq?
Previous Message Scott Marlowe 2009-03-11 04:55:52 Re: any way to convert date via libpq?