duration-from-parts
Returns a value of type xs:duration calculated by combining the following parts supplied as arguments: year, month, day, hour, minute, second, millisecond, negative.
An example duration is P1Y2M3DT04H05M59S, where:
•"P" is the period designator, and is mandatory;
•The rest of the characters denote, in this order: 1 Year, 2 Months, 3 Days, T (Time designator), 04 Hours, 05 Minutes, 59 Seconds.
If the minus character appears before the "P" designator, this indicates a negative duration, for example: -P1D.
Languages
Built-in, C++, C#, Java.
Parameters
Name | Type | Description |
---|---|---|
year | xs:int | Provides the year. |
month | xs:int | Provides the month. |
day | xs:int | Provides the day of the month. |
hour | xs:int | Optional. Provides the hour. |
minute | xs:int | Optional. Provides the minute. |
second | xs:int | Optional. Provides the second. |
millisecond | xs:decimal | Optional. Provides the millisecond. |
negative | xs:boolean | Optional. Must be true for a negative duration; false otherwise. |
Example
The following mapping generates a negative duration of 1 year, 4 months, 17 days, 8 hours, 58 minutes, and 54.333 seconds.
The mapping output is -P1Y4M17DT8H58M54.333S.