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

John Gordon gordon at panix.com
Mon Feb 6 16:54:22 EST 2017


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.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list