Re: Dates BC.
| От | Karel Zak |
|---|---|
| Тема | Re: Dates BC. |
| Дата | |
| Msg-id | 20031219080415.GA24721@zf.jcu.cz обсуждение исходный текст |
| Ответ на | Dates BC. (Kurt Roeckx <Q@ping.be>) |
| Список | pgsql-hackers |
On Thu, Dec 18, 2003 at 02:11:20PM +0100, Kurt Roeckx wrote:
> I find this a little strange:
>
> select date_part('year', '0002-01-01 BC'::date);
> date_part
> -----------
> -1
>
> It seems 1 BC and 0 are the same year.
Is there connection between formatting.c and date_part() ? I don't think so...
> In backend/utils/adt/formatting.c:
>
> if (tmfc.bc)
> {
> if (tm->tm_year > 0)
> tm->tm_year = -(tm->tm_year - 1);
>
> It this normal or a bug?
I think this code is OK, butg is somethere in extract (date_part) code.
test=# select to_date('0020-01-10 BC'::text, 'YYYY-MM-DD BC'); to_date
---------------0020-01-10 BC
(1 řádka)
test=# select to_date('0020-01-10 AD'::text, 'YYYY-MM-DD BC'); to_date
------------0020-01-10
test=# select to_char('0020-01-10 BC'::date, 'YYYY-MM-DD AD'); to_char
---------------0020-01-10 BC Karel
-- Karel Zak <zakkr@zf.jcu.cz>http://home.zf.jcu.cz/~zakkr/
В списке pgsql-hackers по дате отправления: