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

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

Instant (Gregorian calendar)

Derived from: xs:anySimpleType

Primitive type: xs:dateTime

Known subtypes: none

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

Definition

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

Description

This type describes instants identified by a date and time. Its value space is described in ISO 8601 Section 5.4 as a combination of date and time of day. The lexical space is extended format “[-]CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]”. Time zones may be “Z” (UTC) or “(+|-)hh:mm”; unspecified zones are indeterminate.

Restrictions

ISO 8601 basic date-time format “CCYYMMDDThhmmss” 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 is defined by reference to ISO 8601, only the Gregorian calendar is supported.

Lexical space is also defined through ISO 8601, so localization such as different date-component orders or named instead of numeric months is unsupported.

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

Example

Valid values for xs:dateTime include: "2001-10-26T21:32:52", "2001-10-26T21:32:52+02:00", "2001-10-26T19:32:52Z", "2001-10-26T19:32:52+00:00", "-2001-10-26T21:32:52" or "2001-10-26T21:32:52.12679".

Invalid values include "2001-10-26" (all components required), "2001-10-26T21:32" (all components required), "2001-10-26T25:32:52+02:00" (hour 25 is out of range) or "01-10-26T21:32" (all components required).

   

 

 

 

back to top