Name
Date.parse( ): parse a date/time string â ECMAScript v1
Synopsis
Date.parse(date
)
Arguments
-
date
A string containing the date and time to be parsed.
Returns
The number of milliseconds between the specified date and time and midnight GMT on January 1, 1970.
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.
See Also
Date
, Date.setTime( )
, Date.toGMTString( )
, Date.UTC( )
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.