Stylus Studio XML Editor

Table of contents

Appendices

D.1 ISO 8601 Conventions

ISO 8601 Conventions

The primitive datatypes [duration], [dateTime], [time], [date], [gYearMonth], [gMonthDay], [gDay], [gMonth] and [gYear] use lexical formats inspired by [ISO8601]. This appendix provides more detail on the ISO formats and discusses some deviations from them for the datatypes defined in this specification.

[ISO8601] "specifies the representation of dates in the proleptic Gregorian calendar and times and representations of periods of time". The proleptic Gregorian calendar includes dates prior to 1582 (the year it came into use as an ecclesiastical calendar). It should be pointed out that the datatypes described in this specification do not cover all the types of data covered by [ISO8601], nor do they support all the lexical representations for those types of data.

[ISO8601] lexical formats are described using "pictures" in which characters are used in place of digits. For the primitive datatypes [dateTime], [time], [date], [gYearMonth], [gMonthDay], [gDay], [gMonth] and [gYear]. these characters have the following meanings:

  • C -- represents a digit used in the thousands and hundreds components, the "century" component, of the time element "year". Legal values are from 0 to 9.

  • Y -- represents a digit used in the tens and units components of the time element "year". Legal values are from 0 to 9.

  • M -- represents a digit used in the time element "month". The two digits in a MM format can have values from 1 to 12.

  • D -- represents a digit used in the time element "day". The two digits in a DD format can have values from 1 to 28 if the month value equals 2, 1 to 29 if the month value equals 2 and the year is a leap year, 1 to 30 if the month value equals 4, 6, 9 or 11, and 1 to 31 if the month value equals 1, 3, 5, 7, 8, 10 or 12.

  • h -- represents a digit used in the time element "hour". The two digits in a hh format can have values from 0 to 23.

  • m -- represents a digit used in the time element "minute". The two digits in a mm format can have values from 0 to 59.

  • s -- represents a digit used in the time element "second". The two digits in a ss format can have values from 0 to 60. In the formats described in this specification the whole number of seconds may be followed by decimal seconds to an arbitrary level of precision. This is represented in the picture by "ss.sss". A value of 60 or more is allowed only in the case of leap seconds.

    Strictly speaking, a value of 60 or more is not sensible unless the month and day could represent March 31, June 30, September 30, or December 31 in UTC. Because the leap second is added or subtracted as the last second of the day in UTC time, the long (or short) minute could occur at other times in local time. In cases where the leap second is used with an inappropriate month and day it, and any fractional seconds, should considered as added or subtracted from the following minute.

For all the information items indicated by the above characters, leading zeros are required where indicated.

In addition to the above, certain characters are used as designators and appear as themselves in lexical formats.

In the lexical format for [duration] the following characters are also used as designators and appear as themselves in lexical formats:

  • P -- is used as the time duration designator, preceding a data element representing a given duration of time.

  • Y -- follows the number of years in a time duration.

  • M -- follows the number of months or minutes in a time duration.

  • D -- follows the number of days in a time duration.

  • H -- follows the number of hours in a time duration.

  • S -- follows the number of seconds in a time duration.

The values of the Year, Month, Day, Hour and Minutes components are not restricted but allow an arbitrary integer. Similarly, the value of the Seconds component allows an arbitrary decimal. Thus, the lexical format for [duration] and datatypes derived from it does not follow the alternative format of § 5.5.3.2.1 of [ISO8601].