Date.parse( dateString ) in ECMAScript 262
Attempt to parse the supplied string as a date, and return the number of milliseconds it represents.
Arguments
name | type | description |
---|---|---|
dateString | String | The string to parse as a date; |
- Return Type
- Number
Description
This method applies to the Date class, not a particular instance; appropriate usage is:
var numMilliseconds = Date.parse(...);
This method is used by the new Date()
constructor when a single string value is passed as a parameter, so the following two methods of creating a date are equivalent:
var numMilliseconds = Date.parse("12/24/2003 3:15 pm");
var myDate1 = new Date(numMilliseconds);
var myDate2 = new Date("12/24/2003 3:15 pm");
var numMilliseconds = myDate2.valueOf();
As such, this method is solely useful when only the date value (as a number) is important instead of the full Date
object it represents.