mktime, how to handle dates before 01-01-1970 ?

John Yeung gallium.arsenide at gmail.com
Thu Oct 8 17:08:21 EDT 2009


On Oct 6, 5:11 pm, Christian Heimes <li... at cheimes.de> wrote:
> Ben Finney wrote:
> > If you're committed to changing the epoch anyway, I would recommend
> > using <URL:http://en.wikipedia.org/wiki/Astronomical_year_numbering>
> > (epoch at 4004 BCE) since it is widely used to unify dates referring to
> > human history.
>
> I prefer JDN or MJD (http://en.wikipedia.org/wiki/JDN) for dates long
> before or after the unix epoch. The conversion from JDN as float to a
> datetime object is trivial.

I think the choice of epoch is not a big deal, once you pick one far
enough back.  Ben Finney's suggestion to use 4004 BCE is not
appreciably different (computationally) from JDN.  (Though I will say
that the Wikipedia link he provided doesn't mention 4004 BCE, and if
anything suggests using 1 CE as the epoch.)

If there is any difficulty, it would be determining whether historical
records used (for example) the Julian calendar or Gregorian.  This
doesn't seem to be a factor for the OP's use case, so my
recommendation would be to just pick whatever's convenient (either
because some library or program uses it, or because it makes intuitive
sense to the programmer).

John



More information about the Python-list mailing list