Home >>JavaScript Date Object Methods >JavaScript now() Method
JavaScript Date now() method is used to return the number of milliseconds passed since January 1, 1970 00:00:00 UTC. It is a static method of Date.
Syntax:Date.now()
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Date.now() | Yes | 9 | Yes | Yes | Yes |
<html> <body> <p>Click the button to see the Output.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var n = Date.now(); document.getElementById("demo").innerHTML = n; } </script> </body> </html>
Click the button to see the Output.