JavaScript now() Method
You are Here:
JavaScript now() Method
The now
method returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.
Note: The now() is a static method of Date, you always use it as Date.now().
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Diplay Milliseconds</button>
<p id="point"></p>
<script>
function myFunction() {
var d = Date.now();
document.getElementById("point").innerHTML = d;
}
</script>
</body>
</html>
Syntax
Date.now()
Return Value
Value | Explanation |
---|---|
Number | Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC. |
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.