Microsoft® JScript® parse Method |
Language Reference Version 1 |
Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.
Date.parse(dateVal)The dateVal argument is either a string containing a date in a format such as "Jan 5, 1996 08:47:00" or a VT_DATE value retrieved from an ActiveX® object or other object.
The parse method returns an integer value representing the number of milliseconds between midnight, January 1, 1970 and the date supplied in dateVal.The following rules govern what the parse method can successfully parse:The parse method is a static method of the Date object. Because it is a static method, it is invoked as shown in the following example rather than invoked as a method of a created Date object.
var datestring = "November 1, 1997 10:15 AM"; Date.parse(datestring)
function GetTimeTest(testdate) { var d, s, t; var MinMilli = 1000 * 60; var HrMilli = MinMilli * 60; var DyMilli = HrMilli * 24; d = new Date(); t = Date.parse(testdate); s = "There are " s += Math.round(Math.abs(t / DyMilli)) + " days " s += "between " + testdate + " and 1/1/70"; return(s); }