<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/fn.adjustTimeToTimezone.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>fn.adjustTimeToTimezone</api:function-name><api:suggest>fn.adjusttimetotimezone</api:suggest><api:suggest>fn</api:suggest><api:suggest>adjusttimetotimezone</api:suggest><api:function-link mode="xquery" fullname="fn:adjust-time-to-timezone">/apidoc/8.0/fn:adjust-time-to-timezone.xml</api:function-link><api:function mode="javascript" name="adjustTimeToTimezone" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false" prefix="fn" namespace="http://www.w3.org/2005/xpath-functions" fullname="fn.adjustTimeToTimezone"><api: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>
</api:summary><api:params><api:param name="arg" type="xs:time?"><api:param-description>
The time to adjust to the new timezone.
  </api:param-description><api:param-name>arg</api:param-name><api:param-type>String?</api:param-type></api:param><api:param name="timezone" type="xs:dayTimeDuration?" optional="true"><api:param-description>
The new timezone for the date.
  </api:param-description><api:param-name>timezone</api:param-name><api:param-type>xs.dayTimeDuration?</api:param-type></api:param></api:params><api:return>String?</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
Assume the dynamic context provides an implicit timezone
of -05:00 (-PT5H0M).

fn.adjustTimeToTimezone(xs.time("10:00:00"))
=&gt; 10:00:00-05:00

fn.adjustTimeToTimezone(xs.time("10:00:00-07:00"))
=&gt; 12:00:00-05:00

fn.adjustTimeToTimezone(xs.time("10:00:00"), 
  xs:dayTimeDuration("-PT10H"))
=&gt; 10:00:00-10:00

fn.adjustTimeToTimezone(xs.time("10:00:00-07:00"), 
  xs.dayTimeDuration("-PT10H"))
=&gt; 07:00:00-10:00

fn.adjustTimeToTimezone(xs.time("10:00:00"), ())
=&gt; 10:00:00

fn.adjustTimeToTimezone(xs.time("10:00:00-07:00"), ())
=&gt; 10:00:00

fn.adjustTimeToTimezone(
    xs.time("10:00:00-07:00"),
    xs.dayTimeDuration("PT10H"))
=&gt; 03:00:00+10:00
</pre>
</api:example></api:function></api:function-page>