How to use getUTCMilliseconds in JavaScript

In this article, I will explain use of getUTCMilliseconds() method in JavaScript date object.
  • 1446

JavaScript date getUTCMilliseconds() method

  • getMilliseconds() method of date object returns the milliseconds of the specified date according to local time according to universal time.

  • In getMilliseconds() method, The returned value is number between 0 and 999.

Syntax

Date.getUTCMilliseconds()

Example

In the following example show to getUTCMilliseconds() method returns current time millisecond according to universal time..

<!DOCTYPE html>

<html>

<body>

<h3 style="color:red">JavaScript getUTCMilliseconds() Method Example</h3>

<p id="demo">Click for display milliseconds, according to UTC.</p>

<button onclick="myFunction()">Try it</button>

<script type="text/javascript">

    function myFunction() {

        var d = new Date();

        var x = document.getElementById("demo");

        x.innerHTML=document.write("According to UTC, Current Millisecond is: " + d.getUTCMilliseconds());

    }

</script>

</body>

</html>

Output1

getUTCMillesecond 1.jpg

Output2

getUTCMillesecond 2.jpg

You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.