Re: documentation bug? - Mailing list pgsql-hackers

From Oliver Elphick
Subject Re: documentation bug?
Date
Msg-id 1073335705.25138.1372.camel@linda.lfix.co.uk
Whole thread Raw
In response to documentation bug?  (Tatsuo Ishii <t-ishii@sra.co.jp>)
List pgsql-hackers
On Mon, 2004-01-05 at 10:02, Tatsuo Ishii wrote:
> I see following in the doc:
> 
> Table 9-21. Template Patterns for Date/Time Formatting
> :
> :
> J Julian Day (days since January 1, 4712 BC)
> 
> I think 4712 should be 4713. 

template1=# select to_char('1 Jan 4713BC'::date,'J');to_char
---------38
(1 row)

template1=# select to_char('24 Nov 4714BC'::date,'J');to_char
---------0
(1 row)

I think that 1 Jan 4713BC is by the Julian calendar, whereas SQL dates
are defined to be by the Gregorian calendar (even before it existed). 
Those 38 days are presumably the difference between the two calendar
systems at that date.

Here's a little bug:  
template1=# select to_char('24 Nov 0001'::date,'J');to_char
---------1721753
(1 row)

template1=# select to_char('24 Nov 0000'::date,'J');to_char
---------1721388
(1 row)

There is no year 0, so this ought to give an error.  It may explain why
we go back to 4713BC instead of 4712BC.


-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
========================================   "And thou shalt love the LORD thy God with all thine      heart, and with
allthy soul, and with all thy might."                Deuteronomy 6:5 
 



pgsql-hackers by date:

Previous
From: ivan
Date:
Subject: Re: time format
Next
From: Andrew Dunstan
Date:
Subject: Re: PL/Java issues