X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 433DAD1C995 for ; Tue, 6 Apr 2004 15:07:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 68831-07 for ; Tue, 6 Apr 2004 15:07:19 -0300 (ADT) Received: from pcslink.com (pcslink.com [208.145.64.10]) by svr1.postgresql.org (Postfix) with ESMTP id 798D2D1C9E8 for ; Tue, 6 Apr 2004 15:07:17 -0300 (ADT) Received: (from ryan@localhost) by pcslink.com (8.9.3/8.9.2) id LAA22095; Tue, 6 Apr 2004 11:07:15 -0700 (MST) (envelope-from ryan) Date: Tue, 6 Apr 2004 08:07:15 -1000 From: Ryan Mooney To: =?iso-8859-1?Q?Gon=E7alo?= Marrafa Cc: L J Bayuk , pgsql-interfaces@postgresql.org Subject: Re: Date/Time atributes and binary cursors Message-ID: <20040406180715.GA82692@pcslink.com> References: <20040402155110.14a956a1.gjm@uevora.pt> <200404060114.i361EsZ6000560@mindspring.com> <20040406100403.3a60c461.gjm@uevora.pt> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20040406100403.3a60c461.gjm@uevora.pt> User-Agent: Mutt/1.3.25i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/15 X-Sequence-Number: 4836 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 -- >-=-=-=-=-=-=-<>-=-=-=-=-=-<>-=-=-=-=-=-<>-=-=-=-=-=-<>-=-=-=-=-=-=-< Ryan Mooney ryan@pcslink.com <-=-=-=-=-=-=-><-=-=-=-=-=-><-=-=-=-=-=-><-=-=-=-=-=-><-=-=-=-=-=-=->