Re: [SQL] US Date Style - Mailing list pgsql-general

From Manuel Lemos
Subject Re: [SQL] US Date Style
Date
Msg-id 1391.152T2476T11495533mlemos@acm.org
Whole thread Raw
In response to [SQL] US Date Style  (ditilupi <gme@ufba.br>)
List pgsql-general
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
--


pgsql-general by date:

Previous
From: "SUDDN"
Date:
Subject: Read Only from ODBC
Next
From: Vitaliy
Date:
Subject: ...