title: Add one month to a given date (rounded day after) with Python
body: <p>I'd like to add one month to a given date</p>
  
  <pre><code>import datetime
  dt = datetime.datetime(year=2014, month=5, day=2)
  </code></pre>
  
  <p>so I should get</p>
  
  <pre><code>datetime.datetime(year=2014, month=6, day=2)
  </code></pre>
  
  <p>but with</p>
  
  <pre><code>dt = datetime.datetime(year=2015, month=1, day=31)
  </code></pre>
  
  <p>I should get</p>
  
  <pre><code>datetime.datetime(year=2015, month=3, day=1)
  </code></pre>
  
  <p>because there is no 2015-02-31 (and I want my result being round one day <strong>after</strong>)</p>
  
  <p>Some months have 31 days, some other 30, some 29, some 28 !</p>
  
  <p>so adding a <code>datetime.timedelta</code> is probably not a good manner of doing (because we don't know the number of days to add)</p>
  
  <p>I noticed that Pandas have an interesting concept of <code>DateOffset</code></p>
  
  <p><a href="http://pandas.pydata.org/pandas-docs/stable/timeseries.html#dateoffset-objects" rel="nofollow noreferrer">http://pandas.pydata.org/pandas-docs/stable/timeseries.html#dateoffset-objects</a></p>
  
  <p>but I didn't find a <code>Month</code> offset, just <code>MonthBegin</code> or <code>MonthEnd</code></p>
  
  <p>I see also this post
  <a href="https://stackoverflow.com/questions/546321/how-do-i-calculate-the-date-six-months-from-the-current-date-using-the-datetime">How do I calculate the date six months from the current date using the datetime Python module?</a></p>
  
  <p>so I tried <code>dateutil.relativedelta</code> but</p>
  
  <pre><code>from dateutil.relativedelta import relativedelta
  datetime.datetime(year=2015, month=1, day=31)+relativedelta(months=1)
  </code></pre>
  
  <p>returns</p>
  
  <pre><code>datetime.datetime(2015, 2, 28, 0, 0)
  </code></pre>
  
  <p>so result was rounded one day <strong>before</strong>.</p>
  
  <p>Is there a (clean) way to round day <strong>after</strong> ?</p>
  
  <p>edit:
  I gave an example with one month to add but I also want to be able to add for example : 2 years and 6 months (using a <code>relativedelta(years=2, months=6)</code>)</p>