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 55B73310C10 for ; Tue, 1 Jul 2003 09:59:21 +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 25737-05 for ; Tue, 1 Jul 2003 06:59:10 -0300 (ADT) Received: from tomts22-srv.bellnexxia.net (tomts22.bellnexxia.net [209.226.175.184]) by svr1.postgresql.org (Postfix) with ESMTP id 452CC310C14 for ; Tue, 1 Jul 2003 06:59:10 -0300 (ADT) Received: from hwcn.org ([65.92.41.144]) by tomts22-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030701095909.RTQD6317.tomts22-srv.bellnexxia.net@hwcn.org>; Tue, 1 Jul 2003 05:59:09 -0400 Date: Tue, 1 Jul 2003 05:59:13 -0400 Subject: Re: Best way to convert PG's TIMESTAMPTZ to PHP DATE? Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) Cc: To: "David Busby" From: Michael Hanna In-Reply-To: <04d601c33f72$0216b4d0$1100000a@busbydev> Message-Id: Content-Transfer-Encoding: quoted-printable X-Mailer: Apple Mail (2.552) X-Archive-Number: 200307/2 X-Sequence-Number: 2114 Not sure why this results in nothing: $query2 =3D "SELECT to_char(posted, 'Day, DD HH12:MI:SS') FROM=20 healthnotes"; Also, there are multiple postings per day, how do I SELECT only one?=20 DISTINCT? Not sure how to do this.. Finally, if I ever get the output, would nested for-loops properly=20 output the information such that for each date printed, it will print=20 the multiple items on that day? Michael On Monday, June 30, 2003, at 09:42 PM, David Busby wrote: > Hmmm, > Sometimes that happens to me too, I cannot seem to isolate what=20 > causes > it however. When I get that I use the PG to_char function in my=20 > statement > to convert the value to something I can use in PHP. I wish I could=20 > provide > more information about why this is hit and miss. > > /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 =3D pg_num_rows($result); > > // if records present > if ($rows > 0) > { > // iterate through resultset > for ($i=3D0; $i<$rows; $i++) > { > $row =3D pg_fetch_object($result, $i); > $conv_date =3D date('r',strtotime($row->posted)); > ?> >
  • ?> >
    > > notes; ?> >

    > } > } > > On Monday, June 30, 2003, at 04:06 PM, David Busby wrote: > >> Both of these work OK for me >> >> date('r',strtotime($record->date_field)); >> > > > ---------------------------(end of=20 > broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html >