Home >>JavaScript Date Object Methods >JavaScript getUTCMilliseconds() Method

JavaScript getUTCMilliseconds() Method

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()

Browser Support

Method Chrome Edge Firefox Safari Opera
getUTCMilliseconds() Yes Yes Yes Yes Yes
Here is a example of JavaScript getUTCMilliseconds() Method:
<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>
Output:

Example 2:
<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>
Output:

No Sidebar ads