
fn:years-from-duration( $arg as xs:duration? ) as xs:integer?
Returns an xs:integer representing the years component in the canonical lexical representation of the value of $arg. The result may be negative.
If $arg is the empty sequence, returns the empty sequence.
| Parameters | |
|---|---|
| arg | The duration whose year component will be returned. |
fn:years-from-duration(xs:duration("P20Y15M"))
=> 21
fn:years-from-duration(xs:duration("-P15M"))
=> -1
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.