Re: [HACKERS] ISO dates with European Format

Theo Kramer <theo@flame.co.za>

From: Theo Kramer <theo@flame.co.za>
To: Thomas Lockhart <lockhart@alumni.caltech.edu>
Cc: hackers@postgreSQL.org
Date: 1999-09-14T14:03:17Z
Lists: pgsql-hackers
Thomas Lockhart wrote:
> 
> > I have the requirement for ISO dates with European format and would
> > like to change backend/utils/adt/dt.c:EncodeDateTime() and EncodeDateOnly()
> > to effect this if this is a general requirement.
> 
> What is "ISO dates with European format"? Is it a combination of ISO
> date output with European-style input (which I think can be done
> already), or something else? afaik ISO-8601 is specific about
> suggested formats, and makes no distinction between European and other
> conventions. Can you give examples? TIA

Sure -

  coza=> set datestyle to 'SQL,European';
  SET VARIABLE
  coza=> select registrationdate from accounts where domain = 'flame.co.za';
  registrationdate           
  ---------------------------
  02/06/1997 00:00:00.00 SAST
  (1 row)

The above result is correct for dd/mm/yyyy styles

  coza=> set datestyle to 'ISO,European';
  SET VARIABLE
  coza=> select registrationdate from accounts where domain = 'flame.co.za';  
  registrationdate      
  ----------------------
  1997-06-02 00:00:00+02
  (1 row)

Instead of 02-06-1997 00:00:00+02

If ISO is specific regarding formatting of days, month and year then I feel that
the "set datestyle to 'ISO,European'" should give an error. However, I would
personally
prefer it to format the result as "dd-mm-yyyy".

--------
Regards
Theo