alert(Date.parse('Mar 1 1990'));
in jsFiddle, this returns a datetime integer, as expected. On my machine, it returns... a timestamp string?
Thu Mar 01 1990 00:00:00 GMT-0500 (EST)
vs 636267600000
alert(Date.parse('Mar 1 1990'));
in jsFiddle, this returns a datetime integer, as expected. On my machine, it returns... a timestamp string?
Thu Mar 01 1990 00:00:00 GMT-0500 (EST)
vs 636267600000
ECMAScript Language Specification
15.9.4.2 Date.parse (string)
The parse function applies the ToString operator to its argument and interprets the resulting String as a date and time; it returns a Number, the UTC time value corresponding to the date and time. The String may be interpreted as a local time, a UTC time, or a time in some other time zone, depending on the contents of the String. The function first attempts to parse the format of the String according to the rules called out in Date Time String Format (15.9.1.15). If the String does not conform to that format the function may fall back to any implementation-specific heuristics or implementation-specific date formats. Unrecognizable Strings or dates containing illegal element values in the format String shall cause Date.parse to return NaN.
What you probably did wrong was that the two tests were not the same:
alert(Date.parse('Mar 1 1990'));
returns a number (always)
alert(new Date('Mar 1 1990'));
returns the string you mentioned
(because toString method is called on the date object)