setDate method
The setDate method allows
you to change the value of the
day of the month for
date object.
Syntax
date.setDate(day);
Example
Let's set the day:
let date = new Date();
date.setDate(1);
console.log(date);
See also
-
the
setFullYearmethod
that sets the year -
the
setMonthmethod
that sets the month -
the
setHoursmethod
that sets the hours -
the
setMinutesmethod
that sets the minutes -
the
setSecondsmethod
that sets the seconds