Name

[2.0] implicit-timezone()

Returns the implicit timezone used when creating new xs:date, xs:dateTime, and xs:time values.

Syntax

xs:dayTimeDuration implicit-timezone()

Inputs

None.

Outputs

An xs:dayTimeDuration that contains the implicit timezone.

Defined in

XQuery 1.0 and XPath 2.0 Functions and Operators section 16, “Context Functions.”

Example

Here’s a stylesheet that retrieves the implicit timezone as an xs:dayTimeDuration:

<?xml version="1.0"?>
<!-- implicit-timezone.xsl -->
<xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="text"/>

  <xsl:template match="/">
    <xsl:text>&#xA;Using the implicit-timezone() function:&#xA;&#xA;</xsl:text>
    <xsl:text>  The implicit timezone for the current context is: </xsl:text>
    <xsl:value-of select="implicit-timezone()"/>
  </xsl:template>

</xsl:stylesheet>

The stylesheet generates these results:

Using the implicit-timezone() function:

  The implicit timezone for the current context is: -PT5H

The results for Bangalore and London, respectively, look like this:

  The implicit timezone for the current context is: PT5H30M
...
  The implicit timezone for the current context is: PT0S

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.