From: | Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> |
---|---|
To: | Kurt Roeckx <Q(at)ping(dot)be> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Dates BC. |
Date: | 2003-12-19 08:04:15 |
Message-ID: | 20031219080415.GA24721@zf.jcu.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/
From | Date | Subject | |
---|---|---|---|
Next Message | Dann Corbit | 2003-12-19 09:12:08 | Re: Dates BC. |
Previous Message | Shridhar Daithankar | 2003-12-19 06:58:21 | Re: PostgreSQL speakers needed for OSCON 2004 |