Home » JavaScript

now() method with example in JavaScript

JavaScript now() method: Here, we are going to learn about the now() method in JavaScript with example.
Submitted by IncludeHelp, on March 12, 2019

JavaScript now() method

now() method is a Date class method, it is used to current time in milliseconds, it returns the total number of milliseconds since 01st January 1970, 00:00:00 UTC.

Syntax:

    Date.now();

Examples:

    Function call:
    Date.now();

    Output:
    1552398999706

JavaScript code to demonstrate an example of Date.now()

<html>
<head><title>JavaScipt Example</title></head>

<body>
<script>
	var ms = Date.now();
	document.write("ms = " + ms + "<br>");
</script>
</body>
</html>

Output

ms = 1552398999706

Reference: JavaScript now() Method





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.