Sets the month of the date, which is any number 0 or greater. Numbers greater than 11 add years.
var myDate = new Date();
/*from w ww. j a v a 2s.c o m*/
myDate.setMonth(2);
console.log(myDate.toString());
The code above generates the following result.