title: Add days to date using Javascript
body: <p>I am trying to add days to a given date using Javascript. I have the following code:</p>
  <pre><code>function onChange(e) {
      var datepicker = $(&quot;#DatePicker&quot;).val();
      alert(datepicker);
      var joindate = new Date(datepicker);
      alert(joindate);
      var numberOfDaysToAdd = 1;
      joindate.setDate(joindate + numberOfDaysToAdd);
      var dd = joindate.getDate();
      var mm = joindate.getMonth() + 1;
      var y = joindate.getFullYear();
      var joinFormattedDate = dd + '/' + mm + '/' + y;
      $('.new').val(joinFormattedDate);
  }
  </code></pre>
  <p>On first alert I get the date <code>24/06/2011</code> but on second alert I get <code>Thu Dec 06 2012 00:00:00 GMT+0500 (Pakistan Standard Time)</code> which is wrong I want it to remain <code>24/06/2011</code> so that I can add days to it. In my code I want my final output to be <code>25/06/2011</code>.</p>
  <p>Fiddle is @ <a href="http://jsfiddle.net/tassadaque/rEe4v/" rel="nofollow noreferrer">http://jsfiddle.net/tassadaque/rEe4v/</a></p>