Add a month

Fredrik Lundh fredrik at pythonware.com
Fri Feb 17 06:20:51 EST 2006


novin01 at gmail.comn wrote:

> Hi, this is probably a really simple question but...
> How do you add a month to a datetime date in python? It would be nice
> if  you could do something like:
>
> d = datetime.date(2006,2,17)
> dm = datetime.timedelta(months=1)
> d_new = d + dm
>
> but timedelta doesn't have a 'months' setting. Am I missing some easy
> method or do I have to code a work around myself??

what do you expect d_new to be after the operation ?  if the answer
is date(2006,3,17), what's date(2006,1,31) plus one month?

</F>






More information about the Python-list mailing list