6.7.7.1 ISO 8601

The same date can be written down in different formats and Calc tries to allow you to choose your preferred format. Some common formats are ambiguous, however; for example, 10/11/2012 means October 11, 2012 in the United States but it means November 10, 2012 in Europe. To help avoid such ambiguities, the International Organization for Standardization (ISO) provides the ISO 8601 standard, which provides three different but easily distinguishable and unambiguous ways to represent a date.

The ISO 8601 calendar date representation is

   YYYY-MM-DD

where YYYY is the four digit year, MM is the two-digit month number (01 for January to 12 for December), and DD is the two-digit day of the month (01 to 31). (Note that YYYY does not correspond to Calc’s date formatting code, which will be introduced later.) The year, which should be padded with zeros to ensure it has at least four digits, is the Gregorian year, except that the year before 0001 (1 AD) is the year 0000 (1 BC). The date October 11, 2012 is written 2012-10-11 in this representation and November 10, 2012 is written 2012-11-10.

The ISO 8601 ordinal date representation is

  YYYY-DDD

where YYYY is the year, as above, and DDD is the day of the year. The date December 31, 2011 is written 2011-365 in this representation and January 1, 2012 is written 2012-001.

The ISO 8601 week date representation is

 YYYY-Www-D

where YYYY is the ISO week-numbering year, ww is the two digit week number (preceded by a literal “W”), and D is the day of the week (1 for Monday through 7 for Sunday). The ISO week-numbering year is based on the Gregorian year but can differ slightly. The first week of an ISO week-numbering year is the week with the Gregorian year’s first Thursday in it (equivalently, the week containing January 4); any day of that week (Monday through Sunday) is part of the same ISO week-numbering year, any day from the previous week is part of the previous year. For example, January 4, 2013 is on a Friday, and so the first week for the ISO week-numbering year 2013 starts on Monday, December 31, 2012. The day December 31, 2012 is then part of the Gregorian year 2012 but ISO week-numbering year 2013. In the week date representation, this week goes from 2013-W01-1 (December 31, 2012) to 2013-W01-7 (January 6, 2013).

All three ISO 8601 representations arrange the numbers from most significant to least significant; as well as being unambiguous representations, they are easy to sort since chronological order in this formats corresponds to lexicographical order. The hyphens are sometimes omitted.

The ISO 8601 standard uses a 24 hour clock; a particular time is represented by hh:mm:ss where hh is the two-digit hour (from 00 to 24), mm is the two-digit minute (from 00 to 59) and ss is the two-digit second. The seconds or minutes and seconds can be omitted, and decimals can be added. If a date with a time is represented, they should be separated by a literal “T”, so noon on December 13, 2012 can be represented as 2012-12-13T12:00.