dateTime Schema counter proposal

Arnold, Curt Curt.Arnold at
Fri Dec 3 23:20:20 GMT 1999

This message is my starting suggestion for an overhaul of the date and time
related data types in the Sept working draft of the XML Schema Datatypes
document (  I hope this can engender some
discussion on xml-dev and we can then can donate something that can be
incorporated quickly into the XML Schema working groups process (hopefully
in time for the next draft).  I'm am not a W3C member so this is not an
officially endorsed W3C effort.

My problems with the current draft:

1. Acceptance of ISO 8601 truncated forms without a mechanism to disallow
them makes mapping to existing programming language date and time types
problematic and engenders a lot of complexity.  The use of truncated forms
seems to oppose the XML design criteria of not adding complexity to gain

For example, --15-04 is supposed to represent April 15th of every year (or
of an unspecified year).  There is no mechanism to fit that into a datatype
that represents an absolute date (such as VT_VARIANT or COleDateTime or
corresponding Java datatypes/classes).

2. Use of hh:mm:ss form for time durations makes it difficult to represent
intervals like 120 days.  Also, there is no provision for disallowing
non-exact durations (such as durations including years or months terms that
cannot be unambiguously converted to seconds) 

3. There is no mechanism for requiring or disallowing time zone qualifiers.

Okay, here goes

Note: in all the patterns below when I used the + sign, it indicates either
a + or - appearing in its position.

remove timeInstant and recurringTimeInstance.

x.x.x. date

Represents an particular day of a particular calendar year at an explicitly
stated or implied time zone.

x.x.x.x lexicalRepresentation

A single lexical representation, which is a subset of the lexical
representations allowed by ISO 8601, is allowed for date. This lexical
representation is the ISO 8601 extended format with optional time zone
specifier: CCYY-MM-DD[ Z | +hh:mm].  The presence of the time zone qualifier
is controlled using the timeZone facet.
x.x.x time
Represents a specific instant in a unspecified day.
x.x.x.x Lexical Representation
A single lexical representation, which is a subset of the lexical
representations allowed by ISO 8601, is allowed for timeDuration. This
lexical representation is the ISO 8601 extended format Thh:mm[:ss[.sss]][Z |
x.x.x dateTime
A particular instant on a particular date in an particular calendar year.
x.x.x.x Lexical Representation

CCYY-MM-DDThh:mm[:ss[.sss]][ Z | +hh:mm]



x.x.x timeDuration

A time duration is a defined length of time, such as 12 hours.

x.x.x.x Lexical Representation

There are two allowable lexical representation of timeDuration, one is
consistent with ISO 8601 section P[nY][nM][nD][nH][nM], the second
is lexical representation of a real datatype interpreted as duration in


P6W  : Six weeks (this is, 42 days)
P12H30M : Twelve hours 30 minutes
45000 - 45000 seconds
1e-6 - one microsecond

Note: This ISO form was chosen since the alternative representation has
difficultly representing durations such as 120 days.

x.x.x timeZone

Indicates a specific offset from Universal Coordinated Time.

x.x.x.x Lexical Representation

Two forms, the first, Z indicates no offset from UTC, the second is +hh:mm.

Constraining facets

x.x.x timeZone facet

The time zone facet constrains the appearance of a time zone specifier and
qualifies date, time and dateTime datatypes.

Schema for timeZone facet:  I expressed default as an attribute so it could
be distinguished from the default element and could be typed as timeZone.

<element name='timeZone'>
		<attribute name='minOccurs'>
			<datatype name="integer"/>
		<attribute name='maxOccurs'>
			<datatype name="integer"/>
		<attribute name="default">
			<datatype name="timeZone"/>
		<attribute name="fixed">
			<datatype name="boolean"/>

Examples of use

<datatype name="zonedDateTime">
	<basetype name="dateTime"/>
	<!-- time zone must appear -->
	<timeZone minOccurs="1"/>

<datatype name="CSTdefaultTime">
	<basetype name="time"/>
	<!-- if time zone is not specified, it is implied to be CST  -->
	<timeZone default="-06:00"/>

<datatype name="localTime">
	<basetype name="time"/>
	<!-- time zone may not appear  -->
	<timeZone maxOccurs="0"/>

<datatype name="CSTDate">
	<basetype name="date"/>
	<!-- date can either be 1999-12-04 or 1999-12-04-06:00, but no other
time zone    ->
	<timeZone default="-06:00" fixed="true"/>

x.x.x precise facet

The precise facet qualifies timeDuration and disallows the use of year and
month terms (which cannot be unambiguously converted to a duration in


<datatype name="preciseDuration">
	<basetype name="timeDuration"/>

Note: comparisions should not be done of time, dateTime or date datatypes
unless the time zone is explicit or implied by the timeZone facet.

Note: here are some ways of representing some of the ISO 8601 functionality
that we lost, by using multiple attributes (or elements) to hold multiple
pieces of information.

Recurring date:

	<!-- recurring day (one specific Friday) and a recurrence frequency
	<RecurringDay day="1999-12-04" repeats="P1W"/>

<TaxFilingDeadline dayTime="1999-04-15T24:00" repeats="P1Y"/>

Time Period

<TimePeriod start="1999-12-06T09:00-04:00" end="1999-12-06T16:00-04:00"/>
<TimePeriod start="1999-12-06T09:00-04:00" duration="25200"/>
<TimePeriod start="1999-12-06T09:00-04:00" duration="P7H"/>

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list