XML technologies / XML Schema / Data type reference / xs:date

(Excerpt from “XML Schema” by Eric van der Vlist)

Gregorian calendar date

Derived from: xs:anySimpleType

Primitive type: xs:date

Known subtypes: none

Facets: xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace

Definition

<xs:simpleType name="date" id="date">
    <xs:restriction base="xs:anySimpleType">
        <xs:whiteSpace value="collapse" fixed="true"/>
    </xs:restriction>
</xs:simpleType>

Description

This type follows calendar dates in ISO 8601 Section 5.2.1. Its value space is the Gregorian dates defined there, periods of one day. Lexical space is extended ISO 8601 format “[-]CCYY-MM-DD[Z|(+|-)hh:mm]” with an optional time zone; unspecified zones are indeterminate.

Restrictions

ISO 8601 basic calendar-date format “CCYYMMDD” is unsupported.

Other ISO 8601 formats, ordinal dates using year and day-of-year, or dates using week number and day within the week, are unsupported.

Because value space follows ISO 8601, only the Gregorian calendar is supported.

Lexical space also follows ISO 8601; localization such as different component orders or named months is unsupported.

Ordering dates with and without time zones is partial. They can be compared only when at least 14 hours apart.

ISO 8601 defines a day as 24 hours, conflicting with W3C XML Schema, which describes a date as a nonperiodic one-day instance regardless of its hour count. Although technically correct, since leap seconds make some days differ from 24 hours, this conflicts with the definition of xs:duration, where a day is always exactly 24 hours.

Example

Valid values include: "2001-10-26", "2001-10-26+02:00", "2001-10-26Z", "2001-10-26+00:00", "-2001-10-26" or "-20000-04-01".

Invalid values include "2001-10" (all components required), "2001-10-32" (day 32 is out of range), "2001-13-26+02:00" (month 13 is out of range) or "01-10-26" (century missing).

   

 

 

 

back to top