Re: changing datestyle - Mailing list pgsql-novice

From Karl Nack
Subject Re: changing datestyle
Date
Msg-id alpine.DEB.1.10.0906161207510.20782@mindinao
Whole thread Raw
In response to Re: changing datestyle  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: changing datestyle
List pgsql-novice
>> And yet datestyle continues to come back as 'ISO, MDY'.
>
> That's exactly what it should do.  'US' is a synonym for 'MDY',
> and in any case it determines only one of the two components
> of DateStyle.
>
> (The fact that there are two components is a historical aberration,
> and I'd be the first to agree it's ugly, but that's how it works.)

My understanding is that the first component indicates how dates are
output by default, the second how dates are interpreted upon input
(to disambiguate between MDY and DMY).

If this is correct (I'm beginning to think it's not), I'd like something
like 'MDY, MDY', where dates are output as MDY by default (instead of
ISO). That way I don't have to keep writing queries like "SELECT
to_char(date_field, 'MM/DD/YYYY') FROM some_table"

> You need to read the manual a bit more closely, perhaps; or at
> least explain what your *actual* problem is.

Running the following, either directly in psql or upon connecting from a
webserver (php specifically), doesn't change the datestyle setting:
SET datestyle = 'US'
SET datestyle = 'MDY'
SET datestyle = 'MDY, MDY'

I was expecting it to change to something like 'MDY, MDY'.

Obviously I'm missing something here, just not sure what!


Karl Nack

Futurity, Inc.
773-506-2007


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: changing datestyle
Next
From: Tom Lane
Date:
Subject: Re: changing datestyle