How to use getMilliseconds in JavaScript

In this article, I will explain use of getMilliseconds() Method in JavaScript.
  • 1425

JavaScript date getMilliseconds() method

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

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

Syntax

Date.getMilliseconds()

Example

In the following example show to getMilliseconds() method returns current time millisecond.

<!DOCTYPE html>

<html>

<body>

<h3 style="color:Blue">JavaScript getMillisecond() Method Example</h3>

<p id="demo">Click For display Current The milliseconds of the time</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("Current Date Millisecond is: " + d.getMilliseconds());

    }

</script>

</body>

</html>

Output1

getmillisond 1.jpg

Output2

getmillisond 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.