Logo

Programming-Idioms

History of Idiom 61 > diff from v32 to v33

Edit summary for version 33 by programming-idioms.org:
[JS] Okay but it's not a Date object

Version 32

2016-04-07, 09:30:56

Version 33

2018-01-08, 20:54:56

Idiom #61 Get current date

Assign to variable d the current date/time value, in the most standard type.

Idiom #61 Get current date

Assign to variable d the current date/time value, in the most standard type.

Code
var d = Date.now();
Code
var d = Date.now();
Comments bubble
See the documentation for support and polyfills for non-modern browsers.
Comments bubble
This returns the number of milliseconds since epoch (not an object).

See the documentation for support and polyfills for non-modern browsers.
Doc URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now
Doc URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now