This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.



Gets the current date and time.


Return Value

The number of milliseconds between midnight, January 1, 1970, and the current date and time.


The following example illustrates the use of the now method.

var start =;
 var response = prompt("What is your name?", "");
 var end =;
 var elapsed = (end - start) / 1000;
 document.write("You took " + elapsed + " seconds" + " to type: " + response);

 // Output:
 // You took <seconds> seconds to type: <name>


The getTime method returns the number of milliseconds between January 1, 1970, and a specified date.

For information about how to calculate elapsed time and compare dates, see Date and Time Calculations (Windows Scripting - JScript).

See also

Other articles


  • Microsoft Developer Network: Article