title: PHP: generating an end date with user specified start date and duration
body: <p>I am trying to create a function that determines the end date of an advert based on the start date and duration parameter passed by a user.</p>
  
  <p>Example:</p>
  
  <p>If user specify start date as 5th June 2013 and duration as 45 days:</p>
  
  <pre><code>$ad_startdate = '2013-06-05';
  $ad_duration = 45;
  </code></pre>
  
  <p>The function should automatically get the end date which should be 20th July 2013:</p>
  
  <pre><code>$ad_end_date = '2013-07-20';
  </code></pre>
  
  <p>Pls note that to make it easy to generate the end date, I've assigned the variable for months a constant value which will be 30 days. Whether it's february or november or a leap year, every month has a fixed variable value of 30. </p>
  
  <p>I was trying to come up with something around this but just cant figure it out.</p>
  
  <pre><code>$ad_startdate = '2013-06-05';
  $ad_duration = 45;
  
  // End date should be 2013-07-20
  
  
  function getAdvertEndDate ($ad_startdate, $ad_duration){
  
      //Add up start date with duration
      $end_date = strtotime($ad_startdate) + $ad_duration;
  
  return $end_date;
  }
  </code></pre>
  
  <p>I have browsed through SO questions just to see if anyone has something around this but the answered ones are so different from mine challenge.
  Would be very grateful getting help with this.</p>