You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 95 Next »



Termduration
Description

XSD Duration type

The lexical representation for duration is the ISO 8601 extended format PnYnMnDTnHnMnS, where nY represents the number of years, nM the number of months, nD the number of days, 'T' is the date/time separator, nH the number of hours, nM the number of minutes and nS the number of seconds. The number of seconds can include decimal digits to arbitrary precision. P is required.

Comments

The type xsd:duration represents a duration of time expressed as a number of years, months, days, hours, minutes, and seconds. The format of xsd:duration is PnYnMnDTnHnMnS, where P is a literal value that starts the expression, nY is the number of years followed by a literal YnM is the number of months followed by a literal MnD is the number of days followed by a literal DT is a literal value that separates the date and time, nH is the number of hours followed by a literal HnM 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:duration 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.

Examples:

  • P2Y6M5DT12H35M30S 2 years, 6 months, 5 days, 12 hours, 35 minutes, 30 seconds
  • PT20M 20 minutes
XML typexs:duration
StatusApproved
Ref from
Labels
  • No labels