Calendar math problems

John Roth johnroth at ameritech.net
Sun Jan 6 18:13:29 CET 2002


"Ben Logan" <ben at wblogan.net> wrote in message
news:mailman.1010320868.17651.python-list at python.org...
> Hi,
>
> I need to be able to add/subtract an arbitrary number of days to/from
> an arbitrary date.  The days and dates are all within the range
> 1970-2038, so I thought I would convert everything to Unix time
> stamps, do the addition/subtraction on integers, and convert the
> result back to a date tuple.
>
> Is this the best way to accomplish the task?  How would one go about
> it if the dates fall outside the timestamp range?  I looked at the
> calendar module functions, and they would be helpful for writing an
> algorithm to do the dirty work, but I don't see any really easy
> solution.
>
> Thanks,
> Ben

There's also a module on the Vaults that does more
date/time manipulation than most people ever need.
Don't remember the name, but it comes highly recommended.

John Roth





More information about the Python-list mailing list