Lance E Sloan wrote: > When I add that to another mxDateTime object, the month, hour, and > minute get set to those absolute values, but the month is reduced by > four. I know I won't be able to exactly the same thing with datetime. > I think I could do something like this (semi-pseudocode): > > firstTime = datetime.now() > secondTime = firstTime - timedeltaFourMonthsObject > secondTime.replace( day = 14, hour = 23, minute = 59 ) > > The problem is that I can't figure out how to create that > timedeltaFourMonthsObject. The datetime timedelta class constructor > doesn't allow creating a delta with a month. Any suggestions? > > (I think it's a little too bad that the timedelta class represents all > deltas as days and seconds. That must be why they don't support months, > since months have different lengths. IMHO...)
This thread may help: http://groups.google.com/group/comp.lang.python/browse_frm/thread/6c751e2845932c20/08466fb5a150dd9e?hl=en#08466fb5a150dd9e > Also, how can I make a copy of a datetime object? > > timeA = datetime.now() > timeB = timeA # copy or reference to same object? Reference to the same object. one way is: import copy timeB = copy.copy(timeA) Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor