<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/fn.monthsFromDuration.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>fn.monthsFromDuration</api:function-name><api:suggest>fn.monthsfromduration</api:suggest><api:suggest>fn</api:suggest><api:suggest>monthsfromduration</api:suggest><api:function-link mode="xquery" fullname="fn:months-from-duration">/apidoc/8.0/fn:months-from-duration.xml</api:function-link><api:function mode="javascript" name="monthsFromDuration" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false" prefix="fn" namespace="http://www.w3.org/2005/xpath-functions" fullname="fn.monthsFromDuration"><api:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Returns an xs:integer representing the months component in the
canonical lexical representation of the value of $arg. The result may be
negative.
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</api:summary><api:params><api:param name="arg" type="xs:duration?"><api:param-description>
The duration whose month component will be returned.
  </api:param-description><api:param-name>arg</api:param-name><api:param-type>xs.duration?</api:param-type></api:param></api:params><api:return>Number?</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn.monthsFromDuration(xs.duration("P20Y15M"));
=&gt; 3
</pre>
</api:example><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn.monthsFromDuration(xs.duration("-P20Y18M"));
=&gt; -6
</pre>
</api:example></api:function></api:function-page>