Re: [HACKERS] ISO dates with European Format

From: Theo Kramer <theo(at)flame(dot)co(dot)za>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] ISO dates with European Format
Date: 1999-09-14 15:28:21
Message-ID: 37DE6995.81AD5DC0@flame.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Lockhart wrote:
> Ah! The yyyy-mm-dd order is specified by ISO-8601. wrt Postgres, you
> are actually wanting European format with "-" as a date delimiter,
> rather than the "/".

Yuck on ISO and yup to the rest :-).

> As an aside, "ISO,European" does actually have meaning, since setting
> the DateStyle to ISO only fully constrains the output format, but
> "European" helps the date parser resolve free-form date input
> ambiguities by assuming European, rather than US, conventions for
> ordering of input fields.
>
> But back to the delimiter...
>
> Date conventions between and among countries vary. The formats we
> currently have each meet the conventions of multiple countries (not
> certain about "German", since apparently other Germanic countries do
> not all share the same convention). There are (at least) two things we
> could do:
>
> 1) Parameterize the delimiter field using a #define constant you can
> redefine in Makefile.global, Makefile.custom, or configure. Apparently
> South Africa uses the "-" convention for date delimiters? Or is this a
> more local or project-specific preference??

Pretty much project related regarding the delimiter. We tend to use
dd/mm/yyyy locally. I would prefer to not create a specific postgres.

> 2) Parameterize the delimiter as a global character variable, which
> can be manipulated by something like "set DateDelimiter = '-'". This
> is a little nervous-making for me, since you (and every database user)
> would have the ability to modify the date format to something that
> Postgres can not read. So we would have to modify the input routines
> to accept an arbitrary delimiter, as well as the conventional
> delimiters (both "-" and "/") already recognized. I suppose we could
> put constraints on the "set DateDelimiter" values to help protect from
> this...

Hmmm, a product I helped develop uses two mechanisms for specifying
date style. First the format and second the picture. The format
allows swapping of sub fields within a date and a picture to specify
the output. Eg. dd/mm/yyyy as a format with a picture of 99/99/9999 or
mm/dd/yyyy and 99/99/9999 or dd-mmm-yyyy and 99-xxx-9999. This format
allows total control over dates (at least in Western countries) ... I
am happy to donate the code... Windows (int the regional settings) follows
a similar approach.

> You could also consider massaging the date format as it is displayed
> by your app, since that would give you full control over the
> appearance.

True :-). Thanks for the responses.
--------
Regards
Theo

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 1999-09-14 15:44:25 Re: [HACKERS] ISO dates with European Format
Previous Message Tom Lane 1999-09-14 15:21:00 Re: [HACKERS] Status report: long-query-string changes