2.4.6 Date Time String Format for JSON

This section is based upon the ECMAScript 5th Edition Specification, [ECMA-262/5]. The format defined here is used only by JScript 5.8 for the Date.prototype.toJSON method.

ECMAScript defines a string interchange format for date-times based upon a simplification of the [ISO-8601] Extended Format, which is YYYY-MM-DDTHH:mm:ss.sssZ

These fields are defined in the following table:

Field

Definition

YYYY

Decimal digits of the year in the Gregorian calendar.

-

The character "-" (hyphen) appears literally twice in the string.

MM

Month of the year from 01 (January) to 12 (December).

DD

Day of the month from 01 to 31.

T

The character "T" appears literally in the string, to indicate the beginning of the time element.

HH

Number of complete hours that have passed since midnight as two decimal digits.

:

The character ":" (colon) appears literally twice in the string.

mm

Number of complete minutes since the start of the hour as two decimal digits.

Ss

Number of complete seconds since the start of the minute as two decimal digits.

.

The character "." (dot) appears literally in the string. The "." field may be omitted.

sss

Number of complete milliseconds since the start of the second as three decimal digits. The milliseconds field may be omitted.

Z

Time zone offset is specified as "Z" (for UTC), or either "+" or "-" followed by a time expression hh:mm

This format includes date-only forms:

YYYY

YYYY-MM

YYYY-MM-DD

It also includes time-only forms with an optional time zone offset appended:

THH:mm

THH:mm:ss

THH:mm:ss.sss

Also included are "date-times," which may be any combination of the above.

All numbers must be decimal (base 10).

Illegal values (out-of-bounds as well as syntax errors) in a format string means that the format string is not a valid instance of this format.

Because each day both starts and ends with midnight, the two notations 00:00 and 24:00 are available to distinguish the two midnights that can be associated with one date. This means that the following two notations refer to exactly the same moment in time: 1995-02-04T24:00 and 1995-02-05T00:00

There exists no international standard that specifies abbreviations for civil time zones such as CET, EST, PDT, and so on. Sometimes the same abbreviation is even used for two very different time zones. For this reason, [ISO-8601] and this format specify entirely numeric representations of date and time.