Home >>JavaScript Date Object Methods >JavaScript getUTCMilliseconds() Method
The getUTCMilliseconds() method is an inbuilt method in JavaScript which is used to returns the milliseconds (from 0 to 999) in the specified date according to universal time.
Syntax:Date.getUTCMilliseconds()
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
getUTCMilliseconds() | Yes | Yes | Yes | Yes | Yes |
<html> <body> <button onclick="mymillisec()">click me</button> <p id="millisecond"></p> <script> function mymillisec() { var d = new Date(); var z = d.getUTCMilliseconds(); document.getElementById("millisecond").innerHTML = z; } </script> </body> </html>
<html> <body> <script> var ms=new Date(); document.writeln(ms.getHours()+":"); document.writeln(ms.getMinutes()+":"); document.writeln(ms.getSeconds()+":"); document.writeln(ms.getMilliseconds()); </script> </body> </html>