ISO 8601: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 36: Line 36:


  YYYY-MM-DD (extended format) ''or'' YYYYMMDD (basic format)
  YYYY-MM-DD (extended format) ''or'' YYYYMMDD (basic format)
 
  YYYY-MM (but not YYYYMM) (extended format)
  YYYY-MM (but not YYYYMM) (extended format)



Revision as of 21:49, 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, 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.

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