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.
This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book. Arguments and Return TypeName | Type |
$arg |
xs:duration? |
return value |
xs:integer? |
ExamplesXPath Example | 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 |
See AlsoHistory |
Recommended Reading:
|