Datatype: isoDateType

Description:

A datatype of isoDateType will be formatted according to ISO 8601. See http://www.cl.cam.ac.uk/~mgk25/iso-time.html for a discussion of this notation.

The date type is captured in W3C XML Schema datatypes of date and timeInstant. The W3C datatype of date is the format YYYY-MM-DD. It is uncertain whether or not readers will handle truncated versions of this (for example, YYYY-MM). Likewise, the timeInstant datatype includes the time portion, as well as the date portion, and it is also uncertain about how readers will handle truncations. Future version of isoDateType may also include the truncated possibilities.

Note that the isoDateType also includes a time. This makes it comparable to a timestamp.

Proposed Usage:

This datatype was developed to support the use of the ISO Date format as a valid expression of date and/or time.

XML Schema:

  • The schema and examples do not explicitly show the lines that set the namespaces.
  • All schema examples will use xsd: as the namespace for the schema tags and datatypes, and null for all the locally generated namespaces.
  • XML Examples will exclude namespace modifiers for clarity. Actual XML will probably need namespaces.
  • <xsd:simpleType name="isoDateType">
      <xsd:union memberTypes="xsd:date xsd:timeInstant"/>
    </xsd:simpleType>
    

    Sample Usage Schema:

  • This may be used as a choice with other date datatypes to allow other formats. Compare, in particular, with parsedDateType and textDateType.
  • It may be desirable to add an additional layer to identify the date as an ISO formatted date so that a reader application will know. Both methods are shown below.
  •    <xsd:element name="SpudDate" type="isoDateType"/>
    
       <xsd:element name="CompletionDate>
        <xsd:complexType>
         <xsd:sequence>
          <xsd:element name="isoDate" type="isoDateType"/>
         </xsd:sequence>
        </xsd:complexType>
       </xsd:element>
    

    Sample XML:

       <SpudDate>1999-04-22</SpudDate>
    
       <CompletionDate>
        <isoDate>1999-06-03</isoDate>
       </CompletionDate>
    

    Last Modified: March 21, 2001
    ©Copyright 2001 POSC. All rights reserved.