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  <[EMAIL PROTECTED]>
 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

Reply via email to