this date is implemented using a java
Calendar. the aim of this class is to offer a similar behavior to the
Time Values and Time Range
A Date object contains a Number indicating a particular instant in time to
within a millisecond. Such a Number is called a time value. A time value may
also be NaN, indicating that the Date object does not represent a specific
instant of time.
Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC.
In time values leap seconds are ignored. It is assumed that there are exactly
86,400,000 milliseconds per day. ECMAScript Number values can represent all
integers from –9,007,199,254,740,992 to 9,007,199,254,740,992; this range
suffices to measure times to millisecond precision for any instant that is
within approximately 285,616 years, either forward or backward, from 01
January, 1970 UTC.
The actual range of times supported by ECMAScript Date objects is slightly
smaller: exactly –100,000,000 days to 100,000,000 days measured relative to
midnight at the beginning of 01 January, 1970 UTC. This gives a range of
8,640,000,000,000,000 milliseconds to either side of 01 January, 1970 UTC.
The exact moment of midnight at the beginning of 01 January, 1970 UTC is
represented by the value +0.
Date Time String Format
ECMAScript defines a string interchange format for date-times based upon a
simplification of the ISO 8601 Extended Format. The format is as follows:
Where the fields are as follows:
- YYYY is the decimal digits of the year 0000 to 9999 in the Gregorian calendar.
- - “-” (hyphen) appears literally twice in the string.
- MM is the month of the year from 01 (January) to 12 (December).
- DD is the day of the month from 01 to 31.
- T “T” appears literally in the string, to indicate the beginning of the time element.
- HH is the number of complete hours that have passed since midnight as two decimal digits from 00 to 24.
- : “:” (colon) appears literally twice in the string.
- mm is the number of complete minutes since the start of the hour as two decimal digits from 00 to 59.
- ss is the number of complete seconds since the start of the minute as two decimal digits from 00 to 59.
- . “.” (dot) appears literally in the string.
- sss is the number of complete milliseconds since the start of the second as three decimal digits.
- Z is the time zone offset specified as “Z” (for UTC) or either “+” or “-” followed by a time expression HH:mm
This format includes date-only forms:
It also includes “date-time” forms that consist of one of the above date-only
forms immediately followed by one of the following time forms with an optional
time zone offset appended:
All numbers must be base 10. If the MM or DD fields are
absent “01” is used as the value. If the HH, mm, or
ss fields are absent “00” is used as the value and the value
of an absent sss field is “000”. The value of an absent time
zone offset is “Z”.
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.
NOTE 1: As every 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 point in time:
1995-02-04T24:00 and 1995-02-05T00:00
NOTE 2: There exists no international standard that
specifies abbreviations for civil time zones like CET, EST, etc. and sometimes
the same abbreviation is even used for two very different time zones. For this
reason, ISO 8601 and this format specifies numeric representations of date and
The documentation of this class is mostly adapted from the ECMAScript 5.1 Specification: http://www.ecma-international.org/ecma-262/5.1/
Browser compatibility information comes from: http://kangax.github.io/es5-compat-table