Skip to main content
XMLDir

Search 261 pages — tools, formats, elements, namespaces, XPath, datatypes, glossary, parse errors, schema errors, use cases, blog and product.

XSD datatype

xs:date

A calendar date, zero-padded, with an optional timezone that almost nobody expects it to have.

xs:date is YYYY-MM-DD, with the same zero-padding requirement as xs:dateTime and the same real-calendar validation.

It also accepts a timezone: '2026-08-18Z' and '2026-08-18+02:00' are both valid dates. That surprises people, and it means a date can denote different 24-hour windows depending on the offset.

Lexical space
YYYY-MM-DD with an optional Z or ±hh:mm.
Derives from
Primitive type
Category
Date and time types
Facets
minInclusive, maxInclusive, minExclusive, maxExclusive, pattern, enumeration, whiteSpace

What validates

Every literal below is put through the schema validator on each test run, against the schema at the foot of this page.

  • 2026-08-18
  • 2026-08-18Z
  • 2026-08-18+02:00
  • 2024-02-29

What does not

  • 2026-8-18

    Both month and day must be two digits.

  • 18-08-2026

    The order is year, month, day.

  • 2026-02-30

    No such date.

  • 2025-02-29

    2025 is not a leap year.

What catches people out

  • A date can carry a timezone, which means it is not always a fixed 24-hour period.
  • Leap years are validated properly, so 2025-02-29 fails and 2024-02-29 passes.
  • There is no support for partial dates. For a year alone use xs:gYear.

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.

schema.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="v" type="xs:date"/>
</xs:schema>

Open the XSD validator

Related

All 29 datatypes and facets

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.