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:dateTime

A date and time in ISO 8601 form, requiring the T separator and zero-padding. Timezone is optional, which causes more trouble than it saves.

The lexical form is YYYY-MM-DDThh:mm:ss, with an optional fractional second and an optional timezone of Z or ±hh:mm. Every component is zero-padded to its full width — '2026-1-1' is not a date.

The timezone being optional is the design flaw you inherit. A dateTime with no timezone has no defined instant, so two systems can disagree about what it means and both be conforming. Require Z in your own schemas with a pattern facet.

Lexical space
YYYY-MM-DDThh:mm:ss with optional .fraction and 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-18T09:14:22Z
  • 2026-08-18T09:14:22
  • 2026-08-18T09:14:22.123Z
  • 2026-08-18T09:14:22+02:00
  • -0044-03-15T12:00:00Z

What does not

  • 2026-8-18T09:14:22Z

    Months must be zero-padded to two digits.

  • 2026-08-18 09:14:22Z

    The date and time are separated by T, not a space.

  • 2026-08-18T09:14:22EST

    Timezones are Z or a numeric offset, never an abbreviation.

  • 2026-02-30T00:00:00Z

    February has no 30th — dates are checked for real.

  • 2026-08-18

    A dateTime requires the time part.

What catches people out

  • A space instead of T is the most common failure, because that is how most databases print a timestamp.
  • Without a timezone the value has no defined instant. Two conforming systems can read it differently.
  • Real calendar rules apply: 2026-02-30 fails, and 2024-02-29 passes because 2024 is a leap year.
  • Seconds are mandatory. '2026-08-18T09:14Z' is not a valid dateTime.

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.