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:2209:14:22Z24:00:0023:59:59.999
What does not
09:14Seconds are mandatory.
9:14:22Hours must be two digits.
24:00:0124 is only legal as exactly 24:00:00.
25:00:00Hours run 00 to 24.
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:time"/>
</xs:schema>Related
- xs:dateTimeA date and time in ISO 8601 form, requiring the T separator and zero-padding. Timezone is optional, which causes more trouble than it saves.
- xs:dateA calendar date, zero-padded, with an optional timezone that almost nobody expects it to have.
- xs:durationA length of time in ISO 8601 form, starting with P — and only partially ordered, because months have no fixed length.
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.