How about this...

from dateutil.relativedelta import relativedelta
myDate = datetime.date.today() + relativedelta(months=3)

On Sunday, March 15, 2009 at 5:28:24 PM UTC, tin...@isbd.co.uk wrote:
> I have a date in the form of a datetime object and I want to add (for
> example) three months to it.  At the moment I can't see any very
> obvious way of doing this.  I need something like:-
> 
>     myDate = datetime.date.today()
>     inc = datetime.timedelta(months=3)
>     myDate += inc
> 
> but, of course, timedelta doesn't know about months. I had a look at
> the calendar object but that didn't seem to help much.
> 
> -- 
> Chris Green

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to