contents   index   previous   next



Date.parse()

syntax:

Date.parse(datestring)

where:

datestring - A string representing the date and time to be passed

 

return:

number - milliseconds between the datestring and midnight , January 1, 1970 GMT.

 

description:

This method converts the string datestring to a Date object. The string should be in the following format: Friday, October 31, 1998 15:30:00, or a substring of this format. The full format is returned by the Date toGMTString() method, by email and by Internet applications. The day of the week, time zone, time specification or seconds field may be omitted.

 

see:

Date object, Date setTime(), Date toGMTString(), Date.UTC

 

example:

//The following code sets the date to March 2, 1992

var theDate = Date.parse("March 2, 1992")

//Note:

var theDate = Date.parse(datestring);

//is equivalent to:

var theDate = new Date(datestring);

// The following are valid, but not exhaustive

var ms;

ms = Date.parse(new Date().toGMTString());

ms = Date.parse("Mon Aug 20 14:41:01 2001 GMT");

ms = Date.parse("Mon Aug 20 14:41:01 2001");

ms = Date.parse("Mon Aug 20 14:41:01 2001");

ms = Date.parse("August 20 09:35:50 2001");

ms = Date.parse("Aug 20 09:35:50 2001");

ms = Date.parse("August 20, 2001");

ms = Date.parse("August 20 2001");

ms = Date.parse("Aug 20, 2001");

ms = Date.parse("Aug 20 2001");

 


Date.UTC()