minutes-from-duration
The number of minutes in a duration
Description
The fn:minutes-from-duration function calculates the minutes component of a normalized xs:duration value, as an integer between -59 and 59 inclusive. This is not necessarily the same as the integer that appears before the M in the value. For example, if the duration is PT1M90S, the function returns 2 rather than 1. This is because 90 seconds is equal to 1.5 minutes, and the normalized value is therefore PT2M30S. Likewise, if the duration is PT90M, the result is 30, because the normalized value is PT1H30M.
For a function that returns the total number of minutes as a decimal number, see functx:total-minutes-from-duration.
Parameters |
Description |
---|---|
arg:numeric() |
Examples
XPath |
Results |
---|---|
minutes-from-duration(xs:dayTimeDuration(‘PT30M’) |
30 |
minutes-from-duration(xs:dayTimeDuration(‘-PT90M’)) |
-30 |
minutes-from-duration(xs:dayTimeDuration(‘PT1M90S’)) |
2 |
minutes-from-duration(xs:dayTimeDuration(‘PT3H’)) |
0 |
minutes-from-duration(xs:dayTimeDuration(‘PT60M’)) |
0 |