Date.now!
Posted on | June 13, 2012 | No Comments
Here’s a little cool snippet I picked up from MDN. It’s how to implement the Date.now method in browsers that don’t currently support it. The method returns a number value in milliseconds from 1 January 1970 00:00:00 UTC till now.
1 2 3 4 5 | if (!Date.now) { Date.now = function now() { return +(new Date); }; } |
Category: Javascript
Comments
Leave a Reply