mktime, how to handle dates before 01-01-1970 ?
I want to handle datetime vars in a general way, so I use the default
so I can use the standard cinversion procedures.
Time format is the time difference since 1-1-1970.
So how do I handle dates before 1-1-1970 ?
I'ld expect times before 1-1-1970, simply to become negative numbers
(I'm interested in the age of living people, so that would suffice).
Is there a general solution, (other library)
or would it be better to handle all dates in the Delphi format (number
of days since 1-1-1900
Re: mktime, how to handle dates before 01-01-1970 ?
On Oct 6, 5:11*pm, Christian Heimes <li...@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).
|All times are GMT. The time now is 08:38 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.