MarkLogic 12 EA 1 Product Documentation
fn.yearsFromDuration

fn.yearsFromDuration(
   arg as xs.duration?
) as Number?

Summary

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.

Example

fn.yearsFromDuration(xs.duration("P20Y15M"));
=> 21

Example

fn.yearsFromDuration(xs.duration("-P15M"));
=> -1
Powered by MarkLogic Server | Terms of Use | Privacy Policy