getTime Method (Date) (JavaScript)
JavaScript - Internet Explorer 10
Gets the time value in milliseconds.
dateObj.getTime()
When doing multiple date and time calculations, you may want to define variables equal to the number of milliseconds in a day, hour, or minute. For example:
var minute = 1000 * 60; var hour = minute * 60; var day = hour * 24;
See Calculating Dates and Times (JavaScript) for more information about how to use the getTime method.
The following example shows how to use the getTime method.
var minute = 1000 * 60; var hour = minute * 60; var day = hour * 24; date = new Date("1/1/2001"); var time = date.getTime(); document.write(Math.round(time / day) + " days from 1/1/1970 to 1/1/2001"); // Output: 11323 days from 1/1/1970 to 1/1/2001
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. See Version Information.
Applies To: Date Object (JavaScript)