Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

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

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
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

Code Block
themeRDark
languagejavascript
titleTime how long it takes to do some stuff
linenumberstrue
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
Div
classbox
Availability
Status
colourGreen
titleStable

This feature requires:

Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

See also

Related articles:

Div
classbox

Globals

Topics:

Child pages (Children Display)
alltrue
depthall
pageGlobals
excerpttrue