Here's how I do it:

def monthify(anint):
    if anint%12==0:return 12
    else:return anint%12

import datetime
d=datetime.datetime.today()
dplus1month=datetime.datetime(d.year,monthify(d.month+1),d.day)

We need monthify because adding 1 to 12 is bad otherwise!

-Greg

On 17 Feb 2006 04:15:39 -0800, Paul Boddie <[EMAIL PROTECTED]> wrote:
> Fredrik Lundh wrote:
> >
> > 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?
>
> February 31st, of course:
>
> http://sql-info.de/mysql/gotchas.html#1_14
>
> ;-)
>
> Paul
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


--
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to