Expressing time.

Sean null-spam at tfh.ca
Mon Jul 14 11:18:53 EDT 2003


I'm playing around times and dates.  I'd like to determine the age of
particular sets of data in a user friendly matter.

I've got everything ready but dealing with time in a user friendly manner.

What would be a good way to express (in python):
        time.localtime()+30 days
        time.localtime()+5 minutes
        time.localtime()+2 months
        time.localtime()-2 years

I know I could probably just calculate out each of those in seconds but that
seems unelegant and very unfriendly (not to mention prone to error).

Is there any python facilities to make this an easier chore (aka
time.localtime()+months(3))?
(I included months as it is a special case in that you can't just
arbitrarily calculate months in seconds without being relative to a
particular month).

--
Sean






More information about the Python-list mailing list