Skip to content

Instantly share code, notes, and snippets.

@cho45
Created June 10, 2016 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cho45/5e2d40aa0e31f36f44b039259a3caa8b to your computer and use it in GitHub Desktop.
Save cho45/5e2d40aa0e31f36f44b039259a3caa8b to your computer and use it in GitHub Desktop.
Date.now() vs new Date().getTime()
document.body.textContent = new Date().getTime();
document.body.textContent = Date.now();
@FlorentDev
Copy link

Date().GetTime() call a "new" objet and Date.now() call a function. So, if it is just to just the content, it is better to use Date.now().
However, if you want to memorize this time, it can be easier to use something like "time = new Date().getTime();"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment