Re: Date/Time atributes and binary cursors

From: Ryan Mooney <ryan(at)pcslink(dot)com>
To: Gonçalo Marrafa <gjm(at)uevora(dot)pt>
Cc: L J Bayuk <ljb220(at)mindspring(dot)com>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Date/Time atributes and binary cursors
Date: 2004-04-06 18:07:15
Message-ID: 20040406180715.GA82692@pcslink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces


select extract(epoch from timestamp 'oct 1 2004 10:11:17');

On Tue, Apr 06, 2004 at 10:04:03AM +0100, Gonçalo Marrafa wrote:
> Thanks.
>
> Do Postgres/libpq have functions for converting between Unix/Postgres date/time representations or do i have to do it by hand?
>
> Thanks again.
>
>
> > A date is returned as a 4-byte big-endian integer representing the number
> > of days since POSTGRES_EPOCH_DATE.
> > A timestamp is returned as an 8-byte big-endian double precision number of
> > seconds since POSTGRES_EPOCH_DATE.
> > A time is returned as an 8-byte big-endian double precision number of
> > seconds since midnight.
> > POSTGRES_EPOCH_DATE is January 1, 2000 (2000-01-01).
> >
> > Note that binary cursor results are in network data order (big-endian)
> > starting with PostgreSQL-7.4 (versus native server order pre-7.4). This
> > means they need to be byte-swapped if your client runs on an Intel-type
> > little-endian system.
> >
>
>
> --
> Gonçalo Marrafa <gjm(at)uevora(dot)pt>

--
>-=-=-=-=-=-=-<>-=-=-=-=-=-<>-=-=-=-=-=-<>-=-=-=-=-=-<>-=-=-=-=-=-=-<
Ryan Mooney ryan(at)pcslink(dot)com
<-=-=-=-=-=-=-><-=-=-=-=-=-><-=-=-=-=-=-><-=-=-=-=-=-><-=-=-=-=-=-=->

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Nolte, Ronald C. 2004-04-07 13:25:47 installation/verification of pgtcl libraries
Previous Message Gonalo Marrafa 2004-04-06 09:04:03 Re: Date/Time atributes and binary cursors