xsd:dayTimeDuration
The type xsd:dayTimeDuration
represents a duration of time expressed as a number of days, hours, minutes, and seconds. The format of xsd:dayTimeDuration
is PnDTnHnMnS
, where P
is a literal value that starts the expression, nD
is the number of days followed by a literal D
, T
is a literal value that separates the date and time, nH
is the number of hours followed by a literal H
, nM
is the number of minutes followed by a literal M
, and nS
is the number of seconds followed by a literal S
. The following rules apply to xsd:dayTimeDuration
values:
Any of these numbers and corresponding designators may be absent if they are equal to 0, but at least one number and designator must appear.
The numbers may be any unsigned integer, with the exception of the number of seconds, which may be an unsigned decimal number.
If a decimal point appears in the number of seconds, there must be at least one digit after the decimal point.
A minus sign may appear before the
P
to specify a negative duration.If no time items (hour, minute, second) are present, the letter
T
must not appear.
Simple Type Information
Namespace: http://www.w3.org/2001/XMLSchema
Schema Document: builtintypes.xsd
Content
- Based on xsd:duration
- White Space: collapse (Defined in type xsd:duration)
Examples
Valid values | Comment |
---|---|
P1DT2H | 1 day, 2 hours |
PT20M | 20 minutes |
PT120M | 120 minutes (the number of months can be more than 60) |
P0DT1H | 1 hour (0 is permitted as a number, but is not required) |
P0D | 0 days |
-P60D | minus 60 days |
PT1M30.5S | 1 minute, 30.5 seconds |
Invalid values | Comment |
P2Y6M5DT12H35M30S | year and month components are not allowed |
P-20D | the minus sign must appear first |
P20DT | no time items are present, so "T " must not be present |
PT1HM3S | no value is specified for minutes, so "M " must not be present |
P15.5D | only the seconds can be expressed as a decimal |
P1D2H | "T " must be present to separate days and hours |
1DT2H | "P " must always be present |
PT15M5H | hours must appear before minutes |
P | at least one number and designator are required |
PT15.S | at least one digit must follow the decimal point if it appears |
an empty value is not valid, unless xsi:nil is used |
Type Inheritance Chain
- xsd:anyType
- xsd:anySimpleType
- xsd:anyAtomicType
- xsd:duration
- xsd:dayTimeDuration
- xsd:duration
- xsd:anyAtomicType
- xsd:anySimpleType