JavaScript » Date » parse

Syntax:
Date.parse(dateString)

This method returns takes a date string and returns the number of milliseconds since January 01 1970 00:00:00.

This method takes a date string an returns the number of milliseconds since January 01 1970 00:00:00, according to local time. It accepts the standard date syntax, e.g. "Friday, 9 July, 11:10:00 GMT+0130". If a time zone is not specified, this method assumes that the supplied string is local time.

This is a static method of Date and, subsequently, the syntax is always Date.parse() as opposed to objectName.parse().

The following

Examples

Code:
myDate = new Date()
myDate.setTime(Date.parse("July 3, 1999"))
document.write(myDate)
Explanation:

This code uses the Date.parse method to set the value of the myDate object to that of the supplied string.