How to add months to a date (datetime object)?

Casey Webster Caseyweb at
Sun Mar 15 20:10:43 CET 2009

On Mar 15, 2:00 pm, tinn... at wrote:
> No, it's perfectly possible applying simple logic.  My reminder
> program manages it perfectly well.  I have, for example, two sets of
> three monthly reminders.
>     One starts on Jan 19th and repeats three monthly, that means Jan
>     19th, April 19th, July 19th and October 19th.  Very simple.
>     The other is a little more difficult, it starts on December 31st
>     and repeats three monthly.  So that one is on December 31st, March
>     31st, June 30th and September 30th.
> The calendar program manages it perfectly well using what seems to me
> fairly obvious logic, what I want is to be able to do the same in
> Python.

The example you give does have fairly obvious logic. But how does it
handle Feb 28th, 2009 + 3 months?  To me, there are two "obvious"
answers: May 28th, 2009 or May 31st, 2009.  The question is intent; is
Feb 28th an arbitrary day of the month, or is it the last day of the
month, which for something like a monthly bill reminder is more likely?

More information about the Python-list mailing list