[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Date/parse [Back]  [Original]

Date.parse() - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

Date.parse()

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.

Date.parse () 1970 1 1 00:00:00 UTC NaN . ( : 2015-02-31).

ES5 Date.parse . . ( ).

In this article

Syntax

Direct call:

js
Date.parse(dateString);

Implicit call:

js
new Date(dateString);

Parameters

dateString

RFC2822 ISO 8601 ( )

Return value

1970 1 1 00:00:00 UTC . NaN .

Description

parse () ( : "Dec 25, 1995") 1970 1 1 00:00:00 UTC . setTime() Date .

parse () . RFC2822 / IETF (RFC2822 3.3) . "Mon, 25 Dec 1995 13:30:00 GMT". , "Mon, 25 Dec 1995 13:30:00 +0430"( 4 30 ) .

GMT UTC . RFC2822 3.3 .

. "2015-10-12 12:00:00" NaN ECMAScript , UTC .

ECMAScript 5 ISO-8601 format support

ISO 8601 . , "2011-10-10"( ) "2011-10-10T14 : 48 : 00"( ) . ISO 8601 UTC . ISO 8601 .

1970 1 1 00:00:00 UTC NaN .

parse () Date Date Date.parse () .

"March 7, 2014" parse () "2014-03-07" ISO UTC (ES5 ECMAScript 2015) . Date (UTC) ECMAScript . , .

ECMAScript . String . ISO Date.parse () NaN .

ECMA-262 ISO NaN ( :

js
// Non-ISO string with invalid date values
new Date("23/25/2014");

Firefox 30 2015 11 25 , Safari 7 . ISO NaN ES5 :

js
// ISO string with invalid values
new Date("2014-25-23").toISOString();
// returns "RangeError: invalid date" in all es5 compliant browsers

SpiderMonkey jsdate.cpp . "10 06 2014" ISO . .

js
new Date("10 06 2014");

2014 10 6 2014 6 10 . :

js
new Date("foo-bar 2014").toString();
// returns: "Invalid Date"

Date.parse("foo-bar 2014");
// returns: NaN

Examples

Using Date.parse()

IPOdate Date 1995 8 9 ( ) .

js
IPOdate.setTime(Date.parse("Aug 9, 1995"));

.

js
Date.parse("Aug 9, 1995");

ISO GMT-0300 807937200000 local.

js
Date.parse("Wed, 09 Aug 1995 00:00:00 GMT");

GMT (UTC) 807926400000 .

js
Date.parse("Wed, 09 Aug 1995 00:00:00");

ISO GMT-0300 807937200000 .

js
Date.parse("Thu, 01 Jan 1970 00:00:00 GMT");

0 . GMT (UTC) .

js
Date.parse("Thu, 01 Jan 1970 00:00:00");

ISO GMT-0400 14400000 .

js
Date.parse("Thu, 01 Jan 1970 00:00:00 GMT-0400");

14400000 . GMT (UTC) .

Specification
ECMAScript 2027 LanguageSpecification
# sec-date.parse

See also


Web Proxy Viewer  |  New URL  |  Original Page