title: ValueError: day is out of range for month datetime
body: <p>I have run into a problem with some code I have been writing. I take in four inputs ( day, month and year ) as a date, and times for how many times they want to repeat the task ( eg.  every Monday for 3 weeks ). The code is great however if the weeks differ between months I get this error:</p>
  
  <pre><code>  File "C:\Users\dansi\AppData\Local\Programs\Python\Python36-32\gui test 3.py", line 72, in addtimeslot
  fulldateadd = datetime.date(year, month, day)
  ValueError: day is out of range for month
  </code></pre>
  
  <p>Part of code that is relevant:</p>
  
  <pre><code>for i in range(0 , times):
      fulldateadd = datetime.date(year, month, day)
      cursor.execute( '''INSERT INTO dates (Date, Name, Start, End) VALUES( ?,?,?,? );''', (fulldateadd , name1, starttimehour, endtimehour))
      day = day + 7
      if day &gt; 31:
          month = month + 1
  </code></pre>
  
  <p>I've tried to increment the month when the number of days are more than 31 however it doesn't seem to work.</p>