JavaScript getUTCMilliseconds() Method
You are Here:
JavaScript getUTCMilliseconds() Method
The getUTCMilliseconds()
method returns an integer number, between 0 and 999, representing the milliseconds in the given date according to universal time.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display UTC milliseconds of the current date.</p>
<button onclick="myFunction()">Display UTC Milliseconds</button>
<p id="point"></p>
<script>
function myFunction() {
var d = new Date();
var n = d.getUTCMilliseconds();
document.getElementById("point").innerHTML = n;
}
</script>
</body>
</html>
Syntax
Date.getUTCMilliseconds()
Return Value
Value | Explanation |
---|---|
Number | Returns an integer number, between 0 and 999, representing the milliseconds in the given date according to universal time. |
Get UTC Milliseconds from Specific Date
In the following example, we will get the UTC Milliseconds from a specific date.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display UTC milliseconds of the given date.</p>
<button onclick="myFunction()">Display UTC Milliseconds</button>
<p id="point"></p>
<script>
function myFunction() {
var d = new Date("May 19, 1995 02:30:25:619");
var n = d.getUTCMilliseconds();
document.getElementById("point").innerHTML = n;
}
</script>
</body>
</html>
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.