Name

xs:gYearMonth

Synopsis

The xs:gYearMonth type represents a month and year in the Gregorian calendar, such as March, 2005. It is written in the format CCYY-MM, plus an optional time zone suffix in the form ηη:μμ or Z to indicate Coordinated Universal Time (UTC). Dates before year 1 can be indicated by a 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:gYearMonth values in their order of occurrence:

  • -15000000000-05

  • 0004-04

  • 0600-10

  • 1492-11

  • 2005-03+10:00

  • 2005-03Z

  • 2005-03-04:30

  • 100000-07

  • 100000-08

Constraining facets that apply to xs:gYearMonth 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 month and year starts before 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.