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

A time of day, seconds mandatory, with 24:00:00 legal and 24:00:01 not.

xs:time is hh:mm:ss with an optional fraction and an optional timezone. Seconds are required, which rules out the 'HH:MM' that most interfaces produce.

24:00:00 is explicitly allowed and means midnight at the end of the day. Any other hour of 24 is invalid, which is a small piece of trivia that occasionally matters.

Lexical space
hh: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.

  • 09:14:22
  • 09:14:22Z
  • 24:00:00
  • 23:59:59.999

What does not

  • 09:14

    Seconds are mandatory.

  • 9:14:22

    Hours must be two digits.

  • 24:00:01

    24 is only legal as exactly 24:00:00.

  • 25:00:00

    Hours run 00 to 24.

What catches people out

  • Seconds are required. The 'HH:MM' every time picker produces is not a valid xs:time.
  • 24:00:00 is valid and denotes end-of-day; 24:00:01 is not.
  • Leap seconds are not representable — 23:59:60 fails.

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:time"/>
</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.