Re: Date Anomaly??

From: Thomas Good <tomg(at)sqlclinic(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ian Barwick <barwick(at)gmx(dot)net>, Postgres SQL List <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Date Anomaly??
Date: 2003-05-07 15:04:28
Message-ID: Pine.LNX.4.44.0305071047270.29670-100000@q8.nrnet.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 7 May 2003, Tom Lane wrote:

> Thomas Good <tomg(at)sqlclinic(dot)net> writes:
> > Another item: if I say 'export PGDATESTYLE=US' and ask psql for
> > the date I get back an ISO date (YYYY-MM-DD). What region of this
> > US is this, I wonder? Must be San Francisco (maybe Josh knows ;-)
>
> That's only setting a substyle --- one that's not relevant to the ISO
> major style (at least not on output). See the SET reference page.

Tom,

So the closest approximation to the default "postgres[ql]" date style
of MM-DD-YYYY (note delimiters) is: SQL,US which returns a
MM/DD/YYYY 00:00:00 value when doing some date arithmetic?

Have I got it right? Egads...in addition to calling substr() to lose
the 00:00:00 (not terribly useful in this context) I'll have to
call perl's binding operator (=~) to swap in hyphens as delimiters.

Bottom line: there is no way to return a MM-DD-YYYY value?

I never realised that the morphology of the traditional Postgres date
was this complex (its declension was not apparent until I used the
INTERVAL keyword) and so I've conditioned my users to using hyphens
as delimiters...argh. Should have used slashes I suppose.

Oh well. Thanks for the help.

-----------------------------------------------------------------------
Thomas Good e-mail: tomg(at)sqlclinic(dot)net
Programmer/Analyst phone: (+1) 718.818.5528
Residential Services fax: (+1) 718.818.5056
Behavioral Health Services, SVCMC-NY mobile: (+1) 917.282.7359

// Das ist die Kunst - wie man alles verhunzt.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ries van Twisk 2003-05-07 15:07:55 array in a reference
Previous Message Rado Petrik 2003-05-07 14:57:27 ERROR: pg_atoi: error in "NULL": can't parse "NULL"