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

Deborah Swanson python at deborahswanson.net
Mon Feb 6 20:42:37 EST 2017


MRAB wrote,on February 06, 2017 2:17 PM
> 
> On 2017-02-06 21:54, John Gordon wrote:
> > In <mailman.23.1486369390.2318.python-list at python.org> "Deborah 
> > Swanson" <python at deborahswanson.net> writes:
> >
> >> bajimicbiga at gmail.com wrote, on February 02, 2017 2:44 AM
> >> >
> >> > for start of month to the beginning of next month
> >> >
> >> > from datetime import timedelta
> >> > from dateutil.relativedelta import relativedelta
> >> >
> >> > end_date = start_date + relativedelta(months=delta_period) +
> >> > timedelta(days=-delta_period)
> >
> >> Where do you define 'delta_period', and what is your question?
> >
> > There is no question; it is an answer in response to the 
> original post 
> > asking how to add months to a datetime object.
> >
> As far as I can find, the posts were from March 2009!

So that's why I couldn't find any previous posts with that title. And
it's hard to tell, sometimes newcomers fumble around and their first
successful post comes in with a Re: in front of the title.




More information about the Python-list mailing list