X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 762E731099F for ; Tue, 1 Jul 2003 01:49:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 31954-05 for ; Mon, 30 Jun 2003 22:49:39 -0300 (ADT) Received: from seapdc01.PNTS (ip63.c216.blk1.bel.nwlink.com [209.20.216.63]) by svr1.postgresql.org (Postfix) with ESMTP id A8E2A310989 for ; Mon, 30 Jun 2003 22:49:38 -0300 (ADT) Received: from busbydev (BUSBY-DEV [10.0.0.17]) by seapdc01.PNTS with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id N2LV1FJ9; Mon, 30 Jun 2003 19:04:40 -0700 Message-ID: <04e601c33f72$33c05450$1100000a@busbydev> Reply-To: "David Busby" From: "David Busby" To: "Michael Hanna" Cc: References: <20099B92-AB62-11D7-A8B3-00039308EB2C@hwcn.org> Subject: Re: Best way to convert PG's TIMESTAMPTZ to PHP DATE? Date: Mon, 30 Jun 2003 18:43:28 -0700 Organization: Pacific Northwest Ticket Service MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Archive-Number: 200306/47 X-Sequence-Number: 2111 Oh and also that ugly time value is what happens when you try date('r',-1); and the -1 comes from strtotime() not being able to convert the datetime from postgres. /B ----- Original Message ----- From: "Michael Hanna" To: "David Busby" Cc: Sent: Monday, June 30, 2003 18:19 Subject: Re: [PHP] Best way to convert PG's TIMESTAMPTZ to PHP DATE? for some reason I get: Wed, 31 Dec 1969 18:59:59 -0500 as output on any entry. ----- $rows = pg_num_rows($result); // if records present if ($rows > 0) { // iterate through resultset for ($i=0; $i<$rows; $i++) { $row = pg_fetch_object($result, $i); $conv_date = date('r',strtotime($row->posted)); ?>

  • notes; ?>

    Both of these work OK for me > > date('r',strtotime($record->date_field)); >