title: Adding months to a Date in JavaScript
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2706125/javascript-function-to-add-x-months-to-a-date">Javascript function to add X months to a date</a>  </p>
  </blockquote>
  
  
  
  <p>I'd like to add 2 months to a user-input end date. How can I add 2 months to the end date and display it?</p>
  
  <pre><code>/**
  * Click "Cal" on end date
  */
  function getEndDate() {
  if(!document.getElementById('startdate').value.length) {
      alert("Start date must be set first.");
  }
  else {
      prevEndDate = document.getElementById('enddate').value;
      displayCalendar(document.forms[0].enddate,'yyyy/mm/dd',
          document.getElementById('enddatebutton'));
  }
  }
  
  /**
  * Click "Cal" on expiry date
  */
  function getExpiryDate() {
  if(!document.getElementById('enddate').value.length) {
      alert("End date must be set first.");
  }
  else {
      prevExpiryDate = document.getElementById('expirydate').value;
      displayCalendar(document.forms[0].expirydate,'yyyy/mm/dd',
          document.getElementById('expirydatebutton'));
   }
  }
  </code></pre>
  
  <p>Any help is appreciated. Thanks!</p>