The setMilliseconds() method sets the milliseconds of a date object.
The setMilliseconds() method sets the milliseconds of a date object.
Date.setMilliseconds(millisec)
Parameter | Require | Description |
---|---|---|
millisec | Required. | An integer representing the milliseconds |
For the millisec value, the expected values are 0-999, but other values are allowed:
A Number, representing the number of milliseconds between the date object and midnight January 1 1970
Set the milliseconds to 192:
//display the millisecond of a date time, after setting the millisecond. var d = new Date(); d.setMilliseconds(192);/*from ww w. j a v a2 s . com*/ var n = d.getMilliseconds(); console.log(n);