Return current universal time expressed as milliseconds since midnight, January 1, 1970.

 

Syntax

now; // current universal time

Return value

Returns the current universal time expressed in milliseconds since 00:00:00 on January 1, 1970 UTC.

This is directly equivalent to doing: (new Date()).getTime();

Example

function foo() {
  var start = now;
  // do some stuff
  var end = now;
 
  console("time taken to do stuff = "+(end-start)+"ms");
}
 
foo(); // outputs console msg showing time taken
Availability

This feature requires:

Contents

Jump to:

See also

Related articles:

Globals

Topics: