Loading TOC...

MarkLogic 12 EA 2 Product Documentation
fn:months-from-duration

fn:months-from-duration(
   $arg as xs:duration?
) as xs:integer?

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:months-from-duration(xs:duration("P20Y15M"))
=> 3

Example

fn:months-from-duration(xs:duration("-P20Y18M"))
=> -6

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.