Javascript examples for Date:setUTCMilliseconds
The setUTCMilliseconds() method sets the milliseconds from 0 to 999, according to universal time.
UTC time is the same as GMT time.
date.setUTCMilliseconds(millisec);
Parameter | Description |
---|---|
millisec | Required. An integer representing the milliseconds |
millisec 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
The following code shows how to Set the milliseconds to 192, according to UTC time:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from ww w .j ava 2 s . co m var d = new Date(); d.setUTCMilliseconds(192); var n = d.getUTCMilliseconds(); document.getElementById("demo").innerHTML = n; } </script> </body> </html>