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 get the current time in milliseconds, it returns the total number of milliseconds since 01st January 1970, 00:00:00 UTC.
Syntax
Date.now();
        
Sample Input/Output
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
	JavaScript Date Object Methods »
	
	
    
    
    
    
    
  
    Advertisement
    
    
    
  
  
    Advertisement