Tamino XML Server Version 9.7
 —  XQuery 4 Reference Guide  —

xs:duration

Construct a duration value from an item value.


Syntax

xs:duration(item $value) => duration

Top of page

Description

This is a constructor function that takes an item value as argument and returns a value of type xs:duration. If the argument is a literal, then the literal must be a valid lexical form of its type.

As specified in the respective section of the W3C recommendation XML Schema Part 2: Datatypes, a value of type xs:duration represents a duration of time. Its lexical form is PnYnMnDTnh nmns, where nY is the number of years, nM is the number of months, nD is the number of days, T is the separator between date and time, nH is the number of hours, nM is the number of minutes and nS is the number of seconds. Fractions of a second are appended with a leading ".".

You can omit any of the numbers, if they equal zero. However, at least one number and its designator must be present. If you do not specify a time part, the separator character "T" must not be present. The leading "P" must always be present.

You can specify a negative duration by prepending a minus sign. If no sign is used, "+" is assumed.

Top of page

Argument

$value

item value

Top of page

Examples

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:

Top of page