[Zope] Date
Dieter Maurer
dieter@handshake.de
Tue, 21 Nov 2000 23:17:55 +0100 (CET)
Tom Deprez writes:
> Does someone knows how to calculate the date after 6 months of a certain date?
>
> eg ZopeTime() + 6 months?
>
> Is there an easy formula for this? Or do I've to check myself for a new
> year, leap year
When I would need it (and did not find a better method),
I would use (in an external method):
1. convert to a Python time tuple
2. add 6 to the month component (creating a new tuple)
3. convert back to a DateTime object.
It might be necessary to normalize the time tuple
before 3. with an "time.localtime(time.mktime(tup))".
Dieter