Name

xs:gYear

Synopsis

The xs:gYear type represents a year in the Gregorian calendar. It is written in the format CCYY, plus an optional time zone suffix in the form hh:mm or Z to indicate Coordinated Universal Time (UTC). Dates before year 1 can be indicated by a preceding minus sign. At least four digits are used, but additional digits can be added to indicate years after 9999 or before 9999 BCE. These are all valid xs:gYear values in their order of occurrence:

  • -15000000000

  • 0004

  • 0600

  • 1492

  • 2002+10:00

  • 2004Z

  • 2004-04:30

  • 100000

  • 800000000

Constraining facets that apply to xs:gYear are minInclusive, maxInclusive, minExclusive, maxExclusive, pattern, enumeration, and whiteSpace. However, if the time zones are not specified, it may not be possible to determine conclusively whether one year starts before another. If time zones are specified, years are compared by their first moment.

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.