Calendar math problems

Ben Logan ben at wblogan.net
Sun Jan 6 07:39:33 EST 2002


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

-- 
Ben Logan: ben at wblogan dot net
OpenPGP Key KeyID: A1ADD1F0

"The way of the world is to praise dead saints and prosecute live ones."
 -- Nathaniel Howe




More information about the Python-list mailing list