Date instance lets us change various parts of the date and time.
setFullYear lets us set the year of a
setMonth lets us set the month of a
Date instance. It accepts a number from 0 to 11, with 0 being January and 11 being December.
setDate lets us set the day of the month.
setHours lets us set the minutes past an hour.
setSeconds lets us set the seconds past the minute.
setMilliseconds lets us set the milliseconds past the second.
For example, we can call
setFullYear by writing:
let d = new Date(); d.setFullYear(2040);
let d = new Date(); d.setMonth(11);
The rest can be called the same way.