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

javascriptdate.setMilliseconds(milliseconds);

Example

Let's set the milliseconds for the current date:

javascriptlet date = new Date();
date.setMilliseconds(999);

console.log(date);

See also