X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 42134D1B4F9 for ; Wed, 10 Sep 2003 14:01:19 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 63229-06 for ; Wed, 10 Sep 2003 11:00:52 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 639C1D1B4F6 for ; Wed, 10 Sep 2003 11:00:44 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h8ADwBMc028844; Wed, 10 Sep 2003 07:58:52 -0600 (MDT) Date: Wed, 10 Sep 2003 07:55:32 -0600 (MDT) From: "scott.marlowe" To: Grant Henderson Cc: Subject: Re: Date question In-Reply-To: <31EA81C61A3D014F8D6933864F32C60413C8A2@server1.fusion-advertising.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/24 X-Sequence-Number: 2301 On Wed, 10 Sep 2003, Grant Henderson wrote: > How do I convert a postrgesql timestamp > To an english date > > E.g. > $order_date = "2003-09-10 09:40:30+01"; > $date = date("d/M/Y", $order_date); > print($date); You can either split out the parts and use mktime to get a timestamp, then feed that timestamp to date(), or you can do it in postgresql with something like SET DateStyle TO 'US' and then see how they come out. Finally, you could use the extract() function to pull the date in the format you want ahead of time: select extract(YEAR from field)||'/'||extract(MONTH from field)||'/'||extract(day from field); And get it that way.