setMilliseconds method
The setMilliseconds method
allows you to change the number of
milliseconds of the
date object.
It takes the number of milliseconds
as the first parameter.
Syntax
date.setMilliseconds(milliseconds);
Example
Let's set the milliseconds for the current date:
let date = new Date();
date.setMilliseconds(999);
console.log(date);
See also
-
the
setHoursmethod
that sets the hours -
the
setMinutesmethod
that sets the minutes -
the
setSecondsmethod
that sets the seconds