(I\'m reading the book \"Professional JavaScript for Web Developers\" to give a context about this question, specifically Chapter 5 on Reference Types)
I\'m wo
Date.now() function on IE:
return a number of milliseconds between midnight, January 1, 1970, and the current date and time.
Requirements
Not supported in installed versions earlier than Internet Explorer 9. However, it is supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards. Also supported in Windows Store apps.
For get current Date object on IE8, you can use this:
if (typeof Date.now() === 'undefined') {
Date.now = function () {
return new Date();
}
}
For get time value in a Date Object (as the number of milliseconds since midnight January 1, 1970.) on IE8, you can use this:
var currentDateTime = +new Date();