Re: Dates BC.

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Karel Zak" <zakkr(at)zf(dot)jcu(dot)cz>, "Kurt Roeckx" <Q(at)ping(dot)be>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Dates BC.
Date: 2003-12-19 09:12:08
Message-ID: D90A5A6C612A39408103E6ECDD77B8294CE510@voyager.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

There is no zero calendar year. The first year of Anno Domini is 1. It's ordinal, not cardinal.

> -----Original Message-----
> From: Karel Zak [mailto:zakkr(at)zf(dot)jcu(dot)cz]
> Sent: Friday, December 19, 2003 12:04 AM
> To: Kurt Roeckx
> Cc: pgsql-hackers(at)postgresql(dot)org
> Subject: Re: [HACKERS] Dates BC.
>
>
>
> 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/
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
http://www.postgresql.org/docs/faqs/FAQ.html

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Karel Zak 2003-12-19 10:22:03 Re: Dates BC.
Previous Message Karel Zak 2003-12-19 08:04:15 Re: Dates BC.

Browse pgsql-patches by date

  From Date Subject
Next Message Karel Zak 2003-12-19 10:22:03 Re: Dates BC.
Previous Message Karel Zak 2003-12-19 08:37:21 Re: ISO year.