Returns the number of milliseconds in a date string since January 1, 1970, 00:00:00, local time.
Method of Date
Static
Syntax
Date.parse( dateString )
Parameters
:
Parameter | Description |
---|---|
dateString | A string representing a date. |
Description
The parse method takes a date string (such as "Dec 25, 1995") and returns the number of milliseconds since January 1, 1970, 00:00:00 (local time). This function is useful for setting date values based on string values, for example in conjunction with the Date.setTime method and the Date object.
Given a string representing a time, parse returns the time value. It accepts the IETF standard date syntax: "Mon, 25 Dec 1995 13:30:00 GMT". It understands the continental US time-zone abbreviations, but for general use, use a time-zone offset, for example, "Mon, 25 Dec 1995 13:30:00 GMT+0430" (4 hours, 30 minutes west of the Greenwich meridian). If you do not specify a time zone, the local time zone is assumed. GMT and UTC are considered equivalent.
Because parse is a static method of Date, you always use it as Date.parse(), rather than as a method of a Date object you created.
Examples
If IPOdate is an existing Date object, then you can set it to August 9, 1995 as follows: