Re: #203: Timestamps "BC" raise "ValueError: second must be in 0..59"

"James Henstridge" <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On 12/01/2008, Tim Roberts <[email protected]> wrote:
> >  The Python datetime type does not seem to support BC dates:
> >
>
> That is absolutely correct, as the documentation of the datetime module
> says:
>
>  >>> import datetime
>  >>> datetime.date.max
> datetime.date(9999, 12, 31)
>  >>> datetime.date.min
> datetime.date(1, 1, 1)
>  >>>
>
> >  So it isn't just a simple matter of adding code to interpret the "BC"
> >  suffix.
>
> And do what with it?  As long as psycopg uses the Python datetime
> module, there is no way for it to represent dates outside of the range
> of the datetime type.  Even if it interpreted the BC, it couldn't use it.
>
> The eGenix mxDateTime module can handle dates from 5.8 million BC to 5.8
> million AD, and I thought psycopg2 had an option to use mxDateTime as
> its date type.  (psycopg1 used mxDateTime exclusively.)

There is mxDateTime support in psycopg2, so perhaps fixing the parsing
code to handle BC would be enough when it is compiled in that mode.

It would also be worth testing that BC time values get adapted correctly too.

James.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.