Returns the number of milliseconds between January 1, 1970, and the current date and time.
The number of milliseconds between midnight, January 1, 1970, and the current date and time.
The getTime method returns the number of milliseconds between January 1, 1970, and a specified date.
The following example illustrates the use of the now method.
var startMSec = Date.now();
var response = prompt("What is your name?", "");
var endMSec = Date.now();
var elapsed = (endMSec - startMSec) / 1000;
document.write("You took " + elapsed + " seconds" + " to type: " + response);
Supported in the Internet Explorer 9 standards document mode. See Version Information.
Not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards.