Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.
The Date.parse function returns an integer value representing the number of milliseconds between midnight, January 1, 1970 and the date supplied in dateVal.
The following example illustrates the use of the Date.parse function.
The following example returns the difference between the date provided and 1/1/1970.
var minMilli = 1000 * 60; var hrMilli = minMilli * 60; var dyMilli = hrMilli * 24; var testDate = new Date("June 1, 1990"); var ms = Date.parse(testDate); var days = Math.round(ms / dyMilli); var dateStr = ""; dateStr += "There are " + days + " days "; dateStr += "between 01/01/1970 and " + testDate; document.write(dateStr); // Output: There are 7456 days between 01/01/1970 and Fri Jun 1 00:00:00 PDT 1990
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, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information.