Home »
JavaScript
Date getUTCMilliseconds() method with example in JavaScript
JavaScript Date getUTCMilliseconds() method: Here, we are going to learn about the getUTCMilliseconds() method of Date class with Example in JavaScript.
Submitted by IncludeHelp, on March 08, 2019
JavaScript Date getUTCMilliseconds() method
getUTCMilliseconds() method is a Date's class method and it is used to get milliseconds from the current time according to the UTC (Universal time coordinated).
Syntax
var dt = new Date();
dt.getUTCMilliseconds();
Sample Input/Output
Input:
var dt = new Date();
dt.getUTCMilliseconds();
Output:
851
JavaScript code to get the current UTC milliseconds using getUTCMilliseconds() method
<html>
<head><title>JavaScipt Example</title></head>
<body>
<script>
var dt = new Date(); //Date constructor
var ms1 = dt.getUTCMilliseconds(); //UTC Milliseconds
var ms2 = dt.getMilliseconds(); //local Milliseconds
//printing Milliseconds
document.write("UTC Milliseconds = " + ms1 + "<br>");
document.write("Local Milliseconds = " + ms2 + "<br>");
</script>
</body>
</html>
Output
UTC Milliseconds = 851
Local Milliseconds = 851
Reference: JavaScript getUTCMilliseconds() Method
JavaScript Date Object Methods »