Re[2]: [GENERAL] Set DATESTYLE='ISO' (Postgres 6.3.2)

From: Sferacarta Software <sferac(at)bo(dot)nettuno(dot)it>
To: Sangeeta Rao <Sangeeta_Rao(at)mw(dot)3com(dot)com>, Aleksey Dashevsky <postgres(at)luckynet(dot)co(dot)il>, pgsql-general(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re[2]: [GENERAL] Set DATESTYLE='ISO' (Postgres 6.3.2)
Date: 1998-08-26 11:27:50
Message-ID: 16560.980826@bo.nettuno.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces

Hello Aleksey,

mercoledì, 26 agosto 98, you wrote:

AD> On Mon, 24 Aug 1998, Sangeeta Rao wrote:

>>
>> Hi,
>>
>> I am using Postgresql 6.3.2 and would like to set the datestyle to be ISO.
>>
>> Here is what I did:
>>
>> - issued "set datestyle='ISO' " using PQexec() after opening a connection
>> with the database. (no errors)
>> - Then checked the datestyle from psql
>> dbxxx=> show datestyle ;
>> response:
>> NOTICE: DateStyle is Postgres with US (NonEuropean) conventions.
>> - Also, when I open a jdbc connection with debug tracing on I notice that
>> the datestyle is Postgres
>>
>> Why so?? Is this a bug or am I missing something?
>>
>> Instead of issuing 'set datestyle' command if I set the environment
>> variable
>> 'PGDATESTYLE' to ISO it works fine but I would like to avoid having to do
>> this.

AD> Setting datestyle variable has effect only for the session it was issued
AD> in. It was made so to avoid interfernce with another sessions since
AD> they could be started not only by you, but someone else (remember --
AD> PostgreSQL is multiusear). So, the solution is to run postmaster with
AD> "-e" turned on to get the datestyle you need by default-- for details
AD> check manpages postmaster(1) and postgres(1).
AD> Aleksey.

The -e option don't allows ISO format, it's a flag to set
European/NoEuropean.

from man postgres(1):

-e The -e option controls how dates are input to and
output from the database.

If the -e option is supplied, then all dates passed
to and from the frontend processes will be assumed to
be in European format ie. DD-MM-YYYY otherwise dates
are input and output in American format ie. MM-DD-
YYYY

To setting date format you can use one of the following:

1. Setting PGDATESTYLE environment variable.

2. Running postmaster using -oe parameter to set format
date to 'European' convention.

3. Changing the following variables:
bool EuroDates = false / true
int DateStyle = USE_ISO_DATES
on ~/src/backend/utils/init/globals.c file before PostgreSQL installation.

Best regards,
Jose' mailto:sferac(at)bo(dot)nettuno(dot)it

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mark W. Linvill 1998-08-26 15:15:54 6.3.2 Y2K Compliance
Previous Message Gilles Darold 1998-08-26 08:53:48 Option -i !!

Browse pgsql-interfaces by date

  From Date Subject
Next Message David Hartwig 1998-08-26 12:47:12 Re: [INTERFACES] new odbc fails
Previous Message Aleksey Dashevsky 1998-08-26 07:22:47 Re: [GENERAL] Set DATESTYLE='ISO' (Postgres 6.3.2)