Javascript Sucks: Timestamps, getTime, now

Getting ms accurate time in Javascript is damn near impossible. You’ll be off by 100ms or more, usually. If you don’t care, here’s 3 ways to get the same sloppy value:

  1. var yuck = new Date().getTime() //
  2. var bleh = +new Date() //
  3. var leastbad = Date.now() //
This entry was posted in Personal Experience. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>