I want to increment dates using JavaScript I used .setDate(1) to increment dates by one day
but if the date is 31/11/2011 after increment becomes 1/0/2012,
the question is how to increment date by giving the number of days .
js
newDate.setDate(newDate.getDate()+1);
alert(newDate.getFullYear()+"-"+newDate.getMonth()+"-"+newDate.getDate());
That is correct, because in javascript, months are indexed from 0, not 1.
You need to alert like this instead: