ISO 8601: Difference between revisions
No edit summary |
|||
Line 26: | Line 26: | ||
If necessary for a particular application, the standard supports the addition of a decimal fraction to the smallest time value in the representation. | If necessary for a particular application, the standard supports the addition of a decimal fraction to the smallest time value in the representation. | ||
=Year Representation= | =Date Representation= | ||
==Year Representation== | |||
Years are represented as minimum as four-digit representation: | Years are represented as minimum as four-digit representation: | ||
Line 33: | Line 35: | ||
±YYYY | ±YYYY | ||
=Calendar Date Representation= | ==Calendar Date Representation== | ||
YYYY-MM-DD (extended format) ''or'' YYYYMMDD (basic format) | YYYY-MM-DD (extended format) ''or'' YYYYMMDD (basic format) | ||
Line 47: | Line 49: | ||
DD indicates a two-digit day of the month, from 01 to 31. | DD indicates a two-digit day of the month, from 01 to 31. | ||
=Week Date Representation= | ==Week Date Representation== | ||
YYYY-Www (extended format) ''or'' YYYYWww (basic format) | YYYY-Www (extended format) ''or'' YYYYWww (basic format) | ||
Line 53: | Line 55: | ||
YYYY-Www-D (extended format) ''or'' YYYYWwwD (basic format) | YYYY-Www-D (extended format) ''or'' YYYYWwwD (basic format) | ||
=Ordinal Dates= | ==Ordinal Dates== | ||
YYYY-DDD (extended format) ''or'' YYYYDDD (basic format) | YYYY-DDD (extended format) ''or'' YYYYDDD (basic format) | ||
Line 75: | Line 77: | ||
Decimal fractions may be added to any of the three time elements. However, a fraction may only be added to the lowest order time element in the representation. <font color=darkgray>TODO, more here.</font> | Decimal fractions may be added to any of the three time elements. However, a fraction may only be added to the lowest order time element in the representation. <font color=darkgray>TODO, more here.</font> | ||
=Time Zone Designators= | ==Time Zone Designators== | ||
=Durations= | |||
<font color=darkgray>TODO https://en.wikipedia.org/wiki/ISO_8601#Durations</font> | |||
=Time Intervals= | |||
<font color=darkgray>TODO https://en.wikipedia.org/wiki/ISO_8601#Time_intervals</font> |
Revision as of 21:57, 6 November 2018
External
Internal
Overview
ISO 8601 is a standard aimed at providing unambiguous date and time-related data representation. The standard applies to representations of dates in the Gregorian calendar, of times based on 24-hour timekeeping system (00-24), with an optional UTC offset.
Dates and times are arranged so the largest temporal term is placed to the left, and each successively smaller term is placed to the right of the previous term. The following units are represented: year, month (or week), day, hour, minute, second and fraction of a second. The representation is written as a combination of digits and special characters ("-", ".", "T", "W" and "Z"). Full words such as "January" or "Thursday" are not allowed in ISO 8601 interchange representations. Each date and time has a fixed number of digits, with a leading zero padding.
There are two format: 1. Basic format, with a minimal number of separators. The basic format should be avoided in plain text. 2. Extended format with separators added to enhance human readability.
Separators:
- "-" (hyphen) is used to separate date values (year, moth, week and day).
- ":" (colon) is used to separate time values (hours, minutes and seconds).
Values may be dropped from any of the date and time representations, but only in the order from the least to the most significant. "2018-11" is a valid ISO 8601 date.
If necessary for a particular application, the standard supports the addition of a decimal fraction to the smallest time value in the representation.
Date Representation
Year Representation
Years are represented as minimum as four-digit representation:
YYYY ±YYYY
Calendar Date Representation
YYYY-MM-DD (extended format) or YYYYMMDD (basic format) YYYY-MM (but not YYYYMM) (extended format)
YYYYMM is disallowed to avoid confusion with YYMMDD, which is still often used.
--MM-DD (extended format) or --MMDD (basic format)
MM indicates a two-digit moth of the year, from 01 to 12.
DD indicates a two-digit day of the month, from 01 to 31.
Week Date Representation
YYYY-Www (extended format) or YYYYWww (basic format) YYYY-Www-D (extended format) or YYYYWwwD (basic format)
Ordinal Dates
YYYY-DDD (extended format) or YYYYDDD (basic format)
Time Representation
hh:mm:ss.sss (extended format) or hhmmss.sss (basic format) hh:mm:ss (extended format) or hhmmss (basic format) hh:mm (extended format) or hhmm (basic format) hh
"hh" refers to zero left-padded hour between 00 and 24. 24 is used to denote midnight and the end of a calendar day. "mm" refers to zero left-padded minute between 00 and 59. "ss" refers to zero left-padded second between 00 and 60, where 60 is only used to denote an added leap second. Seconds, or minutes and seconds can be omitted from the basic and extended form for brevity (but decreased accuracy).
Midnight may be referred to as "00:00" or "24:00". The notation "00:00" is used at the beginning of a calendar day and is the more frequently used. The end of a day is represented as "24:00".
Time Unit Fraction
Decimal fractions may be added to any of the three time elements. However, a fraction may only be added to the lowest order time element in the representation. TODO, more here.
Time Zone Designators
Durations
TODO https://en.wikipedia.org/wiki/ISO_8601#Durations