XSD datatype
xs:gYear and friends
Gregorian fragments — a year, a month, a day, or a pair of them — for the dates that are genuinely partial.
The g-types cover recurring or partial dates: gYear (2026), gYearMonth (2026-08), gMonth (--08), gDay (---18) and gMonthDay (--08-18). The leading hyphens are part of the lexical form and are what people forget.
gMonth and gMonthDay are for recurring dates — a birthday, a fiscal month — where the year is deliberately absent rather than unknown.
- Lexical space
- YYYY for gYear; YYYY-MM for gYearMonth; --MM, ---DD, --MM-DD for the rest.
- Derives from
- Primitive type
- Category
- Date and time types
- Facets
- minInclusive, maxInclusive, minExclusive, maxExclusive, pattern, enumeration, whiteSpace
The schema used
This is the exact schema the literals above are validated against. Paste it into the validator with one of them to see the result yourself.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="v" type="xs:gYear"/>
</xs:schema>Related
Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.