getUTCMilliseconds()
Returns the UTC date's milliseconds.
UTC time is the same as GMT time.
getUTCMilliseconds() |
Yes | Yes | Yes | Yes | Yes |
dateObject.getUTCMilliseconds();
None.
return a number, from 0-999, representing milliseconds.
var myDate = new Date();
console.log(myDate.getUTCMilliseconds());
The code above generates the following result.
The following code returns the UTC milliseconds from a specific date and time.
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!--from ww w.j av a 2 s . c o m-->
var d = new Date("July 12, 1976 01:23:00:195");
var n = d.getUTCMilliseconds();
document.getElementById("demo").innerHTML = n;
}
</script>
</body>
</html>
The code above is rendered as follows: