Received: from breton.uol.com.br (breton.uol.com.br [200.230.198.74]) by hub.org (8.9.3/8.9.3) with ESMTP id XAA66925 for ; Thu, 27 Apr 2000 23:31:47 -0400 (EDT) (envelope-from mlemos@acm.org) Received: from 200-191-122-130-as.acessonet.com.br (200-191-122-130-as.acessonet.com.br [200.191.122.130]) by breton.uol.com.br (8.9.1/8.9.1) with SMTP id AAA24261; Fri, 28 Apr 2000 00:30:26 -0300 (BRT) Date: 27 Apr 2000 19:9:49 -0200 From: "Manuel Lemos" Subject: Re: [SQL] US Date Style To: ditilupi In-Reply-To: Message-ID: <1391.152T2476T11495533mlemos@acm.org> MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Cc: pgsql-general@postgresql.org X-Mailer: THOR 2.6a (Amiga;TCP/IP) X-Archive-Number: 200004/631 Hello ditilupi, On 27-Apr-00 15:57:01, you wrote: >I'm having this problem with date fields. I'm using the Postgresql7.0beta4 >and programming in PHP3. When I set the environment variable PGDATESTYLE >to "NonEuropean,SQL" it works, but only if I'm in the Pgsql environment. >When I access through the PHP3 it doesn't work. You need to add a PHP statement like Putenv("PGDATESTYLE=ISO"); before connecting with pg_connect or pg_pconnect. Beware that there is a bug in PHP 4 RC1 that resets this environment variable. While you are at it, you may want to try Metabase, a database abstraction package in PHP that comes with a PostgreSQL driver. Among other things it assures that date fields are always returned in the ISO 8601 standard format (YYYY-MM-DD). This format is easier to manage because the fields always occupy fixed prositions and you may use PHP text sorting and comparision functions to sort (sort) or compare (strcmp) dates without having to convert them to time stamp integer values. Metabase is free. Look here to download it: http://phpclasses.UpperDesign.com/browse.html/package/20 Regards, Manuel Lemos Web Programming Components using PHP Classes. Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org -- E-mail: mlemos@acm.org URL: http://www.mlemos.e-na.net/ PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp --