Name

xs:date

Synopsis

The xs:date type represents a specific day in history such as September 26, 2005. Dates are written in the form CCYY - MM - DD. For example, September 26, 2005 is written as 2005-09-26. Dates in the far future and distant past can be written with more than four digits in the year, but at least four digits are required. Dates before year 1 are written with a preceding minus sign. (There was no year 0.) An optional time zone indicator in the form hh:mm may be suffixed to provide a time zone as an offset from Coordinated Universal Time (Greenwich Mean Time, UTC). For example, 2005-09-26-05:00 is September 26, 2005 in the U.S. Eastern time zone. A Z can be used instead to indicate UTC. These are all valid values of type xs:date:

  • 2001-01-01

  • 1999-12-31Z

  • 0482-11-24

  • -0052-10-23

  • 2002-12-23+12:00

  • 87500-01-01

Constraining facets that apply to xs:date are minInclusive, maxInclusive, minExclusive, maxExclusive, pattern, enumeration, and whiteSpace. Note, however, that when the time zone is not specified, it’s not always possible to determine unambiguously whether one date begins after another.

Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.