Re: Some comments about Julian Dates and possible bug. Please provide feedback.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Some comments about Julian Dates and possible bug. Please provide feedback.
Дата
Msg-id 25438.1293645372@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Some comments about Julian Dates and possible bug. Please provide feedback.  (Leslie S Satenstein <lsatenstein@yahoo.com>)
Список pgsql-docs
Leslie S Satenstein <lsatenstein@yahoo.com> writes:
>> I tested and found the algorithm in Postgres to have
>> the day before January 1,0001 calculating as December
>> 31,0000 even though the world calculates the day before
>> January 1,0001 as December 31,-0001.
>
>> 2) Is the algorithm in Postgres correct? �I think
>> not, as the calculations for the difference in days between
>> January 1, 0001 and December 31,-0001 is not 367 days, but
>> just the value 1.

This is not a bug, it's just failure to understand the conventions used
internally.  If you did the calculations at the SQL level you would get
the right answers:

regression=# select '0001-01-01'::date - 1;
   ?column?
---------------
 0001-12-31 BC
(1 row)

regression=# select '0001-01-01'::date - '0001-12-31 BC'::date;
 ?column?
----------
        1
(1 row)

Internally we represent 1 BC as "year zero", 2 BC as "year -1", etc,
but this isn't a problem from users' perspective.

            regards, tom lane

В списке pgsql-docs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Words missing in the following txt
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Words missing in the following txt