[Product-Developers] dates with years before 1900: how to implement?

Raphael Ritz r.ritz at biologie.hu-berlin.de
Mon Feb 28 13:49:50 UTC 2011


On 2/28/11 12:41 PM, Kees Hink wrote:
> For a site with historical references, we're going to store a date on content
> types. However, Zope's 'DateTime' only supports dates from 1900 [1] whereas the
> site may refer to a long time before that. It might even be that we have dates
> where the year is a negative number. (Not billions, but maybe tens of thousands.)
>
> Python's 'datetime' goes back as far as the year 1, so even that may not be
> sufficient, and strftime doesn't work for years before 1901 [2], so that's not
> a big help either.
>
> I'm guessing that using separate fields for year, month and day will be a good
> enough solution for us, for now.
>
> Is there anyone who has experience with this use case, and what did you do?

When I encountered something similar I decided against anything fancy,
just a plain string field(s).
But I also needed to accommodate values such as
"unknown", "1745-1754", "before 1805"  -  not too uncommon
in a historical context. If you need this as well then there
is not much you can do.

Raphael



> Kees
>
> [1]
> http://www.zope.org/Documentation/Books/ZopeBook/2_5_edition/AppendixB.stx#DateTime
> [2] http://docs.python.org/library/datetime.html





More information about the Product-Developers mailing list