[Tutor] is mxDateTime recommended?
kent37 at tds.net
Sat Oct 22 04:40:08 CEST 2005
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:
> 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:
timeB = copy.copy(timeA)
More information about the Tutor