Lance E Sloan wrote: > --On Thursday, October 20, 2005 4:44 PM -0400 Kent Johnson > <[EMAIL PROTECTED]> wrote: > >> Since 2.3 Python includes a datetime module which has some facility for >> date calculations. I think mxDateTime is more sophisticated but if your >> needs are simple take a look at datetime. > > > I think I would like to use the "datetime" module included with Python, > just so I don't need to worry about an additional piece of code, the > "mxDateTime" module. > > In my code, I set up some mxDateTime RelativeDateTime objects that will > be used later: > > secondLockBeginsDelta = DateTime.RelativeDateTime( day = 14, hour = 23, > minute = 59, months = -4 )
You might want to look at dateutils, it can do this. It is an add-on module but it is pure Python. http://labix.org/python-dateutil >>> from datetime import *; from dateutil.relativedelta import * >>> firstTime = datetime.now() >>> offset = relativedelta(day = 14, hour = 23, minute = 59, months = -4 ) >>> firstTime+offset datetime.datetime(2005, 6, 14, 23, 59, 4, 209000) Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor