Javascript Reference - JavaScript setUTCMilliseconds() Method








setUTCMilliseconds
Sets the UTC date's milliseconds.

UTC time is the same as GMT time.

Browser Support

setUTCMilliseconds() Yes Yes Yes Yes Yes

Syntax

dateObject.setUTCMilliseconds(millisec);

Parameter Values

Parameter Description
millisec Required. An integer representing the milliseconds
Expected values are 0-999, but other values are allowed:
-1 will be the last millisecond of the previous second
1000 will be the first millisecond of the next second




Return Value

return a number representing the number of milliseconds between the date object and midnight January 1 1970.

Example


var myDate = new Date();
      
myDate.setUTCMilliseconds(12);
console.log(myDate.toString());

The code above generates the following result.