Sets the day of the month for the date. If the date is greater than the number of days in the month, the month value also gets increased.
/*from www.ja va 2 s. co m*/
var myDate = new Date();
myDate.setDate(12);
console.log(myDate.toString());
The code above generates the following result.