DATE ARITHMETIC

Ajith Prasad aprasad at magix.com.sg
Sun Jun 20 12:08:55 EDT 1999


Noted and thanks for all the feedback.

The difficulty I had with the mxDateTime module was that results seem to be
expressed as date time objects with timestamps embedded with dates  and,
given my limited knowledge of Python (just a few chapters into "Learning
Python") I have no clue as to how to extract just the dates out. But I am
sure that mxDateTime has all the functionality that justifies further
investment in learning it.

In response to my posting, Tim Peters and Jeff Bauer have pointed out
simpler date-time routines that could be used. Tim's routines (available
together with the Python source code disribution) use the American-style
"month-day-year" format while Jeff's use the less ambiguous
"year-month-date" format which also happens to be the format in which my
date data are in. Jeff's notes at
http://starship.python.net/crew/jbauer/normaldate/ make some useful points
on the need for simple routines which handle the more common date arithmetic
tasks without the added complications of dealing with specific calendars,
time zones, etc. Both Tim's and Jeff's routines are geared towards this. I
will look at the further references that Ivan has suggested for a deeper
understanding of the issues.

Ivan Van Laningham <ivanlan at callware.com> wrote in message
news:376C08D8.A9032304 at callware.com...
> Hi All--
>
> Ajith Prasad wrote:
> >
> > I need to do some simple date arithmetic - finding the number of days
> > between any 2 days, the age of a person on a day given his birthday. The
> > mxDateTime module downloadable from the Python website is more complex
than
> > what I need. Any other suggestions?
>
> No.  Date arithmetic is by nature non-trivial.  Marc-Andre's mxDateTime
> is perfectly suited for your application.
>
> If you *really* *really* don't want to use it, though, look up "Julian
> Date" and Scaliger (Joseph Justus) on the web.  Learn how to reduce
> Gregorian dates to Julian Period dates, and once you do that you can add
> and subtract dates as if they have just become big numbers.
>
> Which they will have done, assuming you follow up on Julian Period
> dates.
>
> <8-K'an-12-Sotz'>-ly y'rs,
> Ivan
> ----------------------------------------------
> Ivan Van Laningham
> Callware Technologies, Inc.
>







More information about the Python-list mailing list