Section 24.43. Date.parse( ): parse a datetime string


24.43. Date.parse( ): parse a date/time string

ECMAScript v1

24.43.1. Synopsis

 Date.parse(date) 

24.43.1.1. Arguments

date

A string containing the date and time to be parsed.

24.43.1.2. Returns

The number of milliseconds between the specified date and time and midnight GMT on January 1, 1970.

24.43.2. Description

Date.parse( )is a static method of Date. It is always invoked through the Date constructor as Date.parse( ), not through a Date object as date.parse( ). Date.parse( ) takes a single string argument. It parses the date contained in this string and returns it in millisecond format, which can be used directly, used to create a new Date object, or used to set the date in an existing Date object with Date.setTime( ).

The ECMAScript standard does not specify the format of the strings that can be parsed by Date.parse( ) except to say that this method can parse the strings returned by the Date.toString( ) and Date.toUTCString( ) methods. Unfortunately, these functions format dates in an implementation-dependent way, so it is not, in general, possible to write dates in a way that is guaranteed to be understood by all JavaScript implementations.

24.43.3. See Also

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




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net