MarkLogic 10 Product Documentation
fn.monthsFromDuration

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

Summary

Returns an xs:integer representing the months 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 month component will be returned.

Example

fn.monthsFromDuration(xs.duration("P20Y15M"));
=> 3

Example

fn.monthsFromDuration(xs.duration("-P20Y18M"));
=> -6
Powered by MarkLogic Server | Terms of Use | Privacy Policy