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

S

Stef Mientki

hello,

I want to handle datetime vars in a general way, so I use the default
time-format,
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

thanks,
Stef Mientki
 
J

John Yeung

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top