On Wed, 22 Nov 2000, Tom Deprez wrote:
Hum, but then you also have to take into account the possible year change. But a nice idea.
Tom.
At 23:17 21/11/2000 +0100, Dieter Maurer wrote:
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))".
it seems that DateTime has some functions to do addition and subtraction; i'm not sure about the behaviour, but it can do: aDateTime + other A DateTime may be added to a number and a number may be added to a DateTime; two DateTimes cannot be added maybe you could do some tests to see the results with this functions. see DateTime.html in /path/to/zope/lib/python/DateTime as a guess: aDateTime + 6 x 30 []s Mario O.de Menezes "Many are the plans in a man's heart, but IPEN-CNEN/SP is the Lord's purpose that prevails" http://curiango.ipen.br/~mario Prov. 19.21