fn:minutes-from-duration function
The fn:minutes-from-duration function returns the minutes component of a duration.
Syntax
- duration-value
- The duration value from which the minutes component is to be extracted.
duration-value is an empty sequence, or is a value that has one of the following types: xs:dayTimeDuration, xs:duration, or xs:yearMonthDuration.
Returned value
The return value depends on the type of duration-value:
- If duration-value is of type xs:dayTimeDuration or is of type xs:duration, the returned value is of type xs:integer and is a value between -59 and 59, inclusive. The value is the minutes component of duration-value cast as xs:dayTimeDuration. The value is negative if duration-value is negative.
- If duration-value is of type xs:yearMonthDuration, the returned value is 0.
- If duration-value is an empty sequence, the returned value is an empty sequence.
The minutes component of duration-value cast
as xs:dayTimeDuration is the integer number of minutes computed as ((S
mod 3600) idiv 60)
. The value S is the
total number of seconds of duration-value cast
as xs:dayTimeDuration to remove the years and months components.
Example
The following function returns the minutes component of the duration 2 days, 16 hours, and 93 minutes.
fn:minutes-from-duration(xs:dayTimeDuration("P2DT16H93M"))
The returned value is 33. When calculating the total number of minutes in the duration, 93 minutes is converted to 1 hour and 33 minutes. The duration is equal to P2DT17H33M which has a minutes component of 33 minutes.