From: Josh Berkus <josh@agliodbs.com>
To: Thomas Good <tomg@sqlclinic.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ian Barwick <barwick@gmx.net>
Cc: Postgres SQL List <pgsql-sql@postgresql.org>
Subject: Re: Date Anomaly??
Date: Wed, 7 May 2003 08:36:34 -0700
Message-ID: <200305070836.34610.josh@agliodbs.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0305071047270.29670-100000@q8.nrnet.org>
References: <Pine.LNX.4.44.0305071047270.29670-100000@q8.nrnet.org>
Thomas,
> > > 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 ;-)
Yeah, it's my fault. Here in SF we're never sure what year it is, so we put
the year first. <grin>
> Bottom line: there is no way to return a MM-DD-YYYY value?
Really easy, actually:
SELECT to_char(datefield, 'MM-DD-YYYY');
> 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.
That's the price you pay for having "real" dates instead of the delimited
string stored by other, less sophisticated, database systems.
One of the things on my todo list (Item #18, though) is a pl/perl function
that will accept any reasonable US date and return ISO standard for insert;
I'll post it to the list when I'm done (maybe next week).
--
Josh Berkus
Aglio Database Solutions
San Francisco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com, tomg@sqlclinic.net, tgl@sss.pgh.pa.us, barwick@gmx.net
Subject: Re: Date Anomaly??
In-Reply-To: <200305070836.34610.josh@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox