<apidoc:module name="DurationDateTimeBuiltins" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" lib="fn" xmlns:apidoc="http://marklogic.com/xdmp/apidoc"><apidoc:summary access="public" category="DurationDateTimeBuiltins">
The duration, date, and time built-in functions are XQuery functions 
that operate on duration-, date-, and time-related values.
They are defined in
<a href="http://www.w3.org/TR/xpath-functions/" xmlns="http://www.w3.org/1999/xhtml">XQuery 1.0 
and XPath 2.0 Functions and Operators</a>. 
</apidoc:summary><apidoc:function name="years-from-duration" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Returns an xs:integer representing the years 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>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:duration?" optional="false">
The duration whose year component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:years-from-duration(xs:duration("P20Y15M")) 
returns 21</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:years-from-duration(xs:duration("-P15M")) 
returns -1</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="months-from-duration" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc: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>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:duration?" optional="false">
The duration whose month component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:months-from-duration(xs:duration("P20Y15M")) 
returns 3</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:months-from-duration(xs:duration("-P20Y18M")) 
returns -6</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="days-from-duration" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
Returns an xs:integer representing the days 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>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:duration?" optional="false">
The duration whose day component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:days-from-duration(xs:duration("P3DT10H")) 
returns 3</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:days-from-duration(xs:duration("P3DT55H")) 
returns 5</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="hours-from-duration" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Returns an xs:integer representing the hours 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>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:duration?" optional="false">
The duration whose hour component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:hours-from-duration(xs:duration("P3DT10H")) 
returns 10</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:hours-from-duration(xs:duration("P3DT12H32M12S")) 
returns 12</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:hours-from-duration(xs:duration("PT123H")) 
returns 3</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:hours-from-duration(xs:duration("-P3DT10H")) 
returns -10</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="minutes-from-duration" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Returns an xs:integer representing the minutes 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>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:duration?" optional="false">
The duration whose minute component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:minutes-from-duration(xs:duration("P3DT10H")) 
returns 0</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:minutes-from-duration(xs:duration("-P5DT12H30M")) 
returns -30</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="seconds-from-duration" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Returns an xs:decimal representing the seconds 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>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:duration?" optional="false">
The duration whose minute component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:decimal?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:seconds-from-duration(xs:duration("P3DT10H12.5S")) 
returns 12.5</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:seconds-from-duration(xs:duration("-P256S")) 
returns -16.0</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="year-from-dateTime" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Returns an xs:integer representing the year component in the localized 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>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:dateTime?" optional="false">
The dateTime whose year component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:year-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00")) 
returns 1999</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:year-from-dateTime(xs:dateTime("1999-05-31T21:30:00-05:00")) 
returns 1999</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:year-from-dateTime(xs:dateTime("1999-12-31T19:20:00")) 
returns 1999</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="month-from-dateTime" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
Returns an xs:integer between 1 and 12, both inclusive, representing the
month component in the localized value of $arg. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:dateTime?" optional="false">
The dateTime whose month component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:month-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00")) 
returns 5</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:month-from-dateTime(xs:dateTime("1999-12-31T19:20:00-05:00")) 
returns 12</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:month-from-dateTime(
    fn:adjust-dateTime-to-timezone(
        xs:dateTime("1999-12-31T19:20:00-05:00"), 
        xs:dayTimeDuration("PT0H"))) 
returns 1</pre> 
</apidoc:example>
  </apidoc:function><apidoc:function name="day-from-dateTime" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
Returns an xs:integer between 1 and 31, both inclusive, representing the day
component in the localized value of $arg. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:dateTime?" optional="false">
The dateTime whose day component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:day-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00")) 
returns 31</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:day-from-dateTime(
    xs:dateTime("1999-12-31T20:00:00-05:00")) 
returns 31</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:day-from-dateTime(
    fn:adjust-dateTime-to-timezone(
        xs:dateTime("1999-12-31T19:20:00-05:00"), 
        xs:dayTimeDuration("PT0H"))) 
returns 1</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="hours-from-dateTime" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
Returns an xs:integer between 0 and 23, both inclusive, representing the
hours component in the localized value of $arg. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:dateTime?" optional="false">
The dateTime whose hours component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:hours-from-dateTime(
    xs:dateTime("1999-05-31T08:20:00-05:00")) 
returns 8</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:hours-from-dateTime(
    xs:dateTime("1999-12-31T21:20:00-05:00")) 
returns 21</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:hours-from-dateTime(
  fn:adjust-dateTime-to-timezone(
    xs:dateTime("1999-12-31T21:20:00-05:00"), 
    xs:dayTimeDuration("PT0H")))  
returns 2</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:hours-from-dateTime(
    xs:dateTime("1999-12-31T12:00:00")) 
returns 12</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="minutes-from-dateTime" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Returns an xs:integer value between 0 and 59, both inclusive,
representing the minute component in the localized value of $arg. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:dateTime?" optional="false">
The dateTime whose minutes component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:minutes-from-dateTime(
    xs:dateTime("1999-05-31T13:20:00-05:00")) 
returns 20</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:minutes-from-dateTime(
    xs:dateTime("1999-05-31T13:30:00+05:30")) 
returns 30</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="seconds-from-dateTime" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
Returns an xs:decimal value between 0 and 60.999..., both inclusive
representing the seconds and fractional seconds in the localized value of
$arg. Note that the value can be greater than 60 seconds to accommodate
occasional leap seconds used to keep human time synchronized with the
rotation of the planet. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:dateTime?" optional="false">
The dateTime whose seconds component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:decimal?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:seconds-from-dateTime(
    xs:dateTime("1999-05-31T13:20:00-05:00")) 
returns 0</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="timezone-from-dateTime" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
Returns the timezone component of $arg if any. If $arg has a timezone
component, then the result is an xs:dayTimeDuration that indicates
deviation from UTC; its value may range from +14:00 to -14:00 hours, both
inclusive. Otherwise, the result is the empty sequence. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:dateTime?" optional="false">
The dateTime whose timezone component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:dayTimeDuration?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:timezone-from-dateTime(
    xs:dateTime("1999-05-31T13:20:00-05:00")) 
returns the xs:dayTimeDuration whose value is -PT5H</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:timezone-from-dateTime(
    xs:dateTime("2000-06-12T13:20:00Z")) 
returns the xs:dayTimeDuration whose value is PT0S</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:timezone-from-dateTime(
    xs:dateTime("2004-08-27T00:00:00")) 
returns ()</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="year-from-date" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Returns an xs:integer representing the year component in the localized 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>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:dateTime?" optional="false">
The date whose year component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:year-from-date(xs:date("1999-05-31")) 
returns 1999</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:year-from-date(xs:date("2000-01-01+05:00")) 
returns 2000</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="month-from-date" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Returns an xs:integer between 1 and 12, both inclusive, representing the 
month component in the localized value of $arg.
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:dateTime?" optional="false">
The date whose month component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:month-from-date(xs:date("1999-05-31-05:00")) 
returns 5 </pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:month-from-date(xs:date("2000-01-01+05:00")) 
returns 1</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="day-from-date" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Returns an xs:integer between 1 and 31, both inclusive, representing the day
component in the localized value of $arg. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:dateTime?" optional="false">
The date whose day component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:day-from-date(xs:date("1999-05-31-05:00")) 
returns 31</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:day-from-date(xs:date("2000-01-01+05:00")) 
returns 1</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="timezone-from-date" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
Returns the timezone component of $arg if any. If $arg has a timezone
component, then the result is an xs:dayTimeDuration that indicates
deviation from UTC; its value may range from +14:00 to -14:00 hours, both
inclusive. Otherwise, the result is the empty sequence. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:dateTime?" optional="false">
The date whose timezone component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:dayTimeDuration?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:timezone-from-date(xs:date("1999-05-31-05:00")) 
returns the xs:dayTimeDuration whose value is -PT5H</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:timezone-from-date(xs:date("2000-06-12Z")) 
returns the xs:dayTimeDuration with value PT0H</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="hours-from-time" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
Returns an xs:integer between 0 and 23, both inclusive, representing the
value of the hours component in the localized value of $arg. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:time?" optional="false">
The time whose hours component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:hours-from-time(xs:time("11:23:00")) 
returns 11</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:hours-from-time(xs:time("21:23:00")) 
returns 21</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:hours-from-time(xs:time("01:23:00+05:00")) 
returns 1</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:hours-from-time(
    fn:adjust-time-to-timezone(
         xs:time("01:23:00+05:00"), 
         xs:dayTimeDuration("PT0H"))) 
returns 20</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="minutes-from-time" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
Returns an xs:integer value between 0 to 59, both inclusive, representing
the value of the minutes component in the localized value of $arg. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:time?" optional="false">
The time whose minutes component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:minutes-from-time(xs:time("13:00:00Z")) 
returns 0 </pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="seconds-from-time" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
Returns an xs:decimal value between 0 and 60.999..., both inclusive,
representing the seconds and fractional seconds in the localized value of
$arg. Note that the value can be greater than 60 seconds to accommodate
occasional leap seconds used to keep human time synchronized with the
rotation of the planet. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:time?" optional="false">
The time whose seconds component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:decimal?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:seconds-from-time(xs:time("13:20:10.5")) 
returns 10.5</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="timezone-from-time" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
Returns the timezone component of $arg if any. If $arg has a timezone
component, then the result is an xs:dayTimeDuration that indicates
deviation from UTC; its value may range from +14:00 to -14:00 hours, both
inclusive. Otherwise, the result is the empty sequence. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, returns the empty sequence.
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:time?" optional="false">
The time whose timezone component will be returned.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:dayTimeDuration?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:timezone-from-time(xs:time("13:20:00-05:00")) 
returns xs:dayTimeDuration whose value is -PT5H</pre>
</apidoc:example>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:timezone-from-time(xs:time("13:20:00")) 
returns ()</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="adjust-dateTime-to-timezone" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Adjusts an xs:dateTime value to a specific timezone, or to no
timezone at all. If $timezone is the empty sequence, returns an xs:dateTime
without a timezone. Otherwise, returns an xs:dateTime with a timezone. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $timezone is not specified, then $timezone is the value of the implicit
timezone in the dynamic context. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, then the result is the empty sequence.
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
A dynamic error is raised [err:FODT0003] if $timezone is less than -PT14H or
greater than PT14H or if does not contain an integral number of minutes. 
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
If $arg does not have a timezone component and $timezone is the empty
sequence, then the result is $arg. 
</p><p xmlns="http://www.w3.org/1999/xhtml">  
If $arg does not have a timezone component and $timezone is not the empty
sequence, then the result is $arg with $timezone as the timezone component. 
</p><p xmlns="http://www.w3.org/1999/xhtml">  
If $arg has a timezone component and $timezone is the empty sequence, then
the result is the localized value of $arg without its timezone component. 
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
If $arg has a timezone component and $timezone is not the empty sequence,
then the result is an xs:dateTime value with a timezone component of
$timezone that is equal to $arg. 
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:dateTime?" optional="false">
The dateTime to adjust to the new timezone.
  </apidoc:param>
      <apidoc:param name="timezone" type="xs:dayTimeDuration?" optional="true">
The new timezone for the dateTime.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:dateTime?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
Assume the dynamic context provides an implicit timezone 
of -05:00 (-PT5H0M).
let $tz := xs:dayTimeDuration("-PT10H")
 
fn:adjust-dateTime-to-timezone(
    xs:dateTime("2002-03-07T10:00:00")) 
returns 2002-03-07T10:00:00-05:00

fn:adjust-dateTime-to-timezone(
    xs:dateTime("2002-03-07T10:00:00-07:00")) 
returns 2002-03-07T12:00:00-05:00

fn:adjust-dateTime-to-timezone(
     xs:dateTime("2002-03-07T10:00:00"), $tz) 
returns 2002-03-07T10:00:00-10:00

fn:adjust-dateTime-to-timezone(
    xs:dateTime("2002-03-07T10:00:00-07:00"), $tz) 
returns 2002-03-07T07:00:00-10:00

fn:adjust-dateTime-to-timezone(
    xs:dateTime("2002-03-07T10:00:00-07:00"), 
    xs:dayTimeDuration("PT10H")) 
returns 2002-03-08T03:00:00+10:00

fn:adjust-dateTime-to-timezone(
    xs:dateTime("2002-03-07T00:00:00+01:00"), 
    xs:dayTimeDuration("-PT8H")) 
returns 2002-03-06T15:00:00-08:00

fn:adjust-dateTime-to-timezone(
    xs:dateTime("2002-03-07T10:00:00"), ()) 
returns 2002-03-07T10:00:00

fn:adjust-dateTime-to-timezone(
    xs:dateTime("2002-03-07T10:00:00-07:00"), ()) 
returns 2002-03-07T10:00:00</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="adjust-date-to-timezone" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Adjusts an xs:date value to a specific timezone, or to no timezone at
all. If $timezone is the empty sequence, returns an xs:date without a
timezone. Otherwise, returns an xs:date with a timezone. For purposes of
timezone adjustment, an xs:date is treated as an xs:dateTime with time
00:00:00. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $timezone is not specified, then $timezone is the value of the implicit
timezone in the dynamic context. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, then the result is the empty sequence.
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
A dynamic error is raised [err:FODT0003] if $timezone is less than -PT14H or
greater than PT14H or if does not contain an integral number of minutes. 
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
If $arg does not have a timezone component and $timezone is the empty
sequence, then the result is $arg. 
</p><p xmlns="http://www.w3.org/1999/xhtml">  
If $arg does not have a timezone component and $timezone is not the empty
sequence, then the result is $arg with $timezone as the timezone component. 
</p><p xmlns="http://www.w3.org/1999/xhtml">  
If $arg has a timezone component and $timezone is the empty sequence, then
the result is the localized value of $arg without its timezone component. 
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
If $arg has a timezone component and $timezone is not the empty sequence, then:
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
Let $srcdt be an xs:dateTime value, with 00:00:00 for the time component and
date and timezone components that are the same as the date and timezone
components of $arg.  
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
Let $r be the result of evaluating fn:adjust-dateTime-to-timezone($srcdt,
$timezone) 
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
The result of this function will be a date value that has date and timezone
components that are the same as the date and timezone components of $r. 
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:date?" optional="false">
The date to adjust to the new timezone.
  </apidoc:param>
      <apidoc:param name="timezone" type="xs:dayTimeDuration?" optional="true">
The new timezone for the date.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:date?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
Assume the dynamic context provides an implicit timezone 
of -05:00 (-PT5H0M).
let $tz := xs:dayTimeDuration("-PT10H")

fn:adjust-date-to-timezone(xs:date("2002-03-07")) 
returns 2002-03-07-05:00.

fn:adjust-date-to-timezone(xs:date("2002-03-07-07:00")) 
returns 2002-03-07-05:00. $arg is converted to the xs:dateTime 
"2002-03-07T00:00:00-07:00". This is adjusted to the implicit 
timezone, giving "2002-03-07T02:00:00-05:00".

fn:adjust-date-to-timezone(
    xs:date("2002-03-07"), $tz) 
returns 2002-03-07-10:00.

fn:adjust-date-to-timezone(
    xs:date("2002-03-07-07:00"), $tz) 
returns 2002-03-06-10:00. $arg is converted to the xs:dateTime 
"2002-03-07T00:00:00-07:00". This is adjusted to the given 
timezone, giving "2002-03-06T21:00:00-10:00".

fn:adjust-date-to-timezone(xs:date("2002-03-07"), ()) 
returns 2002-03-07.

fn:adjust-date-to-timezone(
    xs:date("2002-03-07-07:00"), ()) 
returns 2002-03-07.</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="adjust-time-to-timezone" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Adjusts an xs:time value to a specific timezone, or to no timezone at
all. If $timezone is the empty sequence, returns an xs:time without a
timezone. Otherwise, returns an xs:time with a timezone.  
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $timezone is not specified, then $timezone is the value of the implicit
timezone in the dynamic context. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, then the result is the empty sequence.
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
A dynamic error is raised [err:FODT0003] if $timezone is less than -PT14H or
greater than PT14H or if does not contain an integral number of minutes. 
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
If $arg does not have a timezone component and $timezone is the empty
sequence, then the result is $arg. 
</p><p xmlns="http://www.w3.org/1999/xhtml">  
If $arg does not have a timezone component and $timezone is not the empty
sequence, then the result is $arg with $timezone as the timezone component. 
</p><p xmlns="http://www.w3.org/1999/xhtml">  
If $arg has a timezone component and $timezone is the empty sequence, then
the result is the localized value of $arg without its timezone component. 
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
If $arg has a timezone component and $timezone is not the empty sequence, then:
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
Let $srcdt be an xs:dateTime value, with an arbitrary date for the date
component and time and timezone components that are the same as the time
and timezone components of $arg. 
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
Let $r be the result of evaluating fn:adjust-dateTime-to-timezone($srcdt,
$timezone) 
</p><p xmlns="http://www.w3.org/1999/xhtml"> 
The result of this function will be a time value that has time and timezone
components that are the same as the time and timezone components of $r. 
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="arg" type="xs:date?" optional="false">
The date to adjust to the new timezone.
  </apidoc:param>
      <apidoc:param name="timezone" type="xs:dayTimeDuration?" optional="true">
The new timezone for the date.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:integer?</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
Assume the dynamic context provides an implicit timezone 
of -05:00 (-PT5H0M).
let $tz := xs:dayTimeDuration("-PT10H")

fn:adjust-time-to-timezone(xs:time("10:00:00")) 
returns 10:00:00-05:00

fn:adjust-time-to-timezone(xs:time("10:00:00-07:00")) 
returns 12:00:00-05:00

fn:adjust-time-to-timezone(xs:time("10:00:00"), $tz) 
returns 10:00:00-10:00

fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"), $tz) 
returns 07:00:00-10:00

fn:adjust-time-to-timezone(xs:time("10:00:00"), ()) 
returns 10:00:00

fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"), ()) 
returns 10:00:00

fn:adjust-time-to-timezone(
    xs:time("10:00:00-07:00"), 
    xs:dayTimeDuration("PT10H")) 
returns 03:00:00+10:00</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="subtract-dateTimes-yielding-yearMonthDuration" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
[0.9-ml only, use the minus operator ( - ) instead] Returns the 
<code>xdt:yearMonthDuration</code> that corresponds to the difference between 
the normalized value of $srcval1 and the normalized value of $srcval2. If 
either argument is the empty sequence, returns the empty sequence. If the
normalized value of $srcval1 precedes in time the normalized value of
$srcval2, the returned value is a negative duration. 
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="srcval1" type="xs:dateTime" optional="false">
   The first xs:dateTime value.
  </apidoc:param>
      <apidoc:param name="srcval1" type="xs:dateTime" optional="false">
   The second xs:dateTime value.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xdt:yearMonthDuration</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
xquery version "0.9-ml"
fn:subtract-dateTimes-yielding-yearMonthDuration(
  fn:current-dateTime(), 
  xs:dateTime("2000-01-11T12:01:00.000Z"))
=&gt; the yearMonthDuration P8Y10M, or whatever is 
   correct for the current date
</pre>
</apidoc:example>
  </apidoc:function><apidoc:function name="subtract-dateTimes-yielding-dayTimeDuration" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
[0.9-ml only, use the minus operator ( - ) instead] Returns the 
<code>xdt:dayTimeDuration</code> that corresponds to the difference between 
the normalized value of $srcval1 and the normalized value of $srcval2. 
If either argument is the empty sequence, returns the empty sequence. 
If the normalized value of $srcval1 precedes in time the normalized value of 
$srcval2, then the returned value is a negative duration. 
</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="srcval1" type="xs:dateTime" optional="false">
   The first xs:dateTime value.
  </apidoc:param>
      <apidoc:param name="srcval1" type="xs:dateTime" optional="false">
   The second xs:dateTime value.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xdt:dayTimeDuration</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
xquery version "0.9-ml"
fn:subtract-dateTimes-yielding-dayTimeDuration(
  fn:current-dateTime(), 
  xs:dateTime("2000-01-11T12:01:00.000Z"))
=&gt; the dayTimeDuration P3240DT14H49M46.37S, or 
   whatever is correct for the current date
</pre>
</apidoc:example>
  </apidoc:function></apidoc:module>