The setUTCMilliseconds() method sets the milliseconds between 0 to 999, according to universal time.
The setUTCMilliseconds() method sets the milliseconds between 0 to 999, according to universal time.
UTC time is the same as GMT time.
Date.setUTCMilliseconds(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, according to UTC time:
//display the UTC milliseconds of a date time, after setting the UTC milliseconds. var d = new Date(); d.setUTCMilliseconds(192);//from ww w. j a v a 2 s . c o m var n = d.getUTCMilliseconds(); console.log(n);