Date.setDate()
Sets the day of the month of a date object.
var event = new Date('August 19, 1975 23:15:30');
event.setDate(24);
console.log(event.getDate());
// expected output: 24
event.setDate(32);
// Only 31 days in August!
console.log(event.getDate());
// expected output: 1
Syntax
dateObj.setDate(dayValue)Parameters
Description
Examples
Using setDate()
setDate()References
Contributors to this page
Last updated