title: How to add 1 month on a date without skipping i.e. february
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3602405/php-datetimemodify-adding-and-subtracting-months">PHP DateTime::modify adding and subtracting months</a>  </p>
  </blockquote>
  
  
  
  <p>I have a starting date (i.e. 2011-01-30) and want to add 1 month.</p>
  
  <p>The problem is in defining what a month is. So if I use the following code:</p>
  
  <pre><code>$d1 = DateTime::createFromFormat('Y-m-d H:i:s', '2011-01-30 15:57:57');
  $d1-&gt;add(new DateInterval('P1M'));
  echo $d1-&gt;format('Y-m-d H:i:s');
  </code></pre>
  
  <p>I get the following result: 2011-03-02 15:57:57</p>
  
  <p>The problem is, that I need it to use the following rules:</p>
  
  <ul>
  <li>If I add 1 month it will just add 1 on the month part and leave the day part
  (2011-01-15 will become 2011-02-15)</li>
  <li>If the day is not existing in the month we will end, we take the last existing day of it
  (2011-01-30 will become 2011-02-28)</li>
  </ul>
  
  <p>Is there a common function in php that can do this or do I have to code it by myself? 
  Maybe I'm just missing a parameter or something!?</p>