Re: [SQL] US Date Style

From: "Manuel Lemos" <mlemos(at)acm(dot)org>
To: ditilupi <gme(at)ufba(dot)br>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [SQL] US Date Style
Date: 2000-04-27 21:09:49
Message-ID: 1391.152T2476T11495533mlemos@acm.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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(at)acm(dot)org
--
E-mail: mlemos(at)acm(dot)org
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Wolfe 2000-04-27 21:17:33 Re: Row Size
Previous Message Steve Wolfe 2000-04-27 19:56:12 Re: [SQL] US Date Style

Browse pgsql-sql by date

  From Date Subject
Next Message Johann Spies 2000-05-15 12:55:03 sanity check fails
Previous Message Steve Wolfe 2000-04-27 19:56:12 Re: [SQL] US Date Style