Name

xs:gMonth

Synopsis

The xs:gMonth type represents a certain month of the year in the Gregorian calendar as an integer between --01 and --12. An optional time zone suffix in the form hh:mm or Z to indicate Coordinated Universal Time (UTC) can be added as well. These are all valid xs:gMonth values:

  • --01

  • --12

  • --12Z

  • --09+02:00

  • --03-11:00

Tip

The original release of XML Schema Part 2: Datatypes had a mistake here. It specified extra hyphens after the month part; for instance, --01-- and --12--. Some schema processors still allow or require this format.

The g indicates that the month is given using the Gregorian calendar. Schema date types are not localizable to non-Gregorian calendars. If you need a different calendar, you’ll need to derive from xs:string using the pattern facet.

Constraining facets that apply to xs:gMonth 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 starts before another. If time zones are specified, months are compared by their first moment. Thus, --12-05:00 is greater than --12-Z, which is greater than --12+02:00.

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.