Re: Day of week question

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Day of week question
Date: 2003-10-05 21:51:47
Message-ID: 3F809273.1000805@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:

>"Andrew Dunstan" <andrew(at)dunslane(dot)net> writes:
>
>
>>Looks like it is caused by the switch to the Gregorian calendar in 1752,
>>when 11 days were chopped out of September ( in England and America -
>>elsewhere anywhere between Oct 1582 and early 20th century).
>>
>>
>
>There was some discussion awhile back about extending PG's date code
>to know about the Julian calendar, but the idea pretty much died when
>it was pointed out that you'd need locale-specific information about
>exactly when the switchover occurred.
>
>SQL99 makes it perfectly clear that all datetime values are Gregorian,
>for example we find wording like this in the <literal> section:
>
> 9) If <date value> is specified, then it is interpreted as a date
> in the Gregorian calendar.
>
>So one could argue that the existing PG behavior is SQL-compliant.
>I tend to regard this as an easy out, but nonetheless it's an available
>defense if someone tries to beat you up about PG's "wrong answers".
>
>
Perhaps we need a function or two to convert pre-gregorian dates to
gregorian dates and vice versa, with the cutover date either a
configuration variable (default the 1752 date) or a parameter of the
function.

e.g. j_to_g('1700-01-01'::date) => '1700-01-13'
j_to_g('1800-01-01'::date) => '1800-01-01'

just a thought

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2003-10-05 21:52:50 Re: Learning PostgreSQL
Previous Message Peter Eisentraut 2003-10-05 21:49:32 Re: pg_dump and REVOKE on function