XSLT and XPath function reference in alphabetical order

(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

fn:month-from-dateTime

Category:

Value extraction from time values, date values and duration

Origin:

XPath 2.0

Return value:

An integer of xs:integer type which corresponds to the value of the month component of the normalised timestamp value passed on.

Call/Arguments:

fn:month-from-dateTime($timestampValue)

$timestampValue:

Optional. A timestamp value of xs:dateTime type which may contain a timezone indication. If the input sequence is empty, the function returns the empty sequence.

Purpose of use:

The function returns an integer between 1 and 12, depending on the value of the month component of the input value. If there is an implicit or an explicit timezone indication, the value is accordingly normalised before the extraction of the component value.

During the normalisation, a date jump may occur by allocating the timezone difference and the daytime component of the value. This date jump possibly has also an effect on the value of the month component (see example 2).

Example 1 - month component from timestamp value:

fn:month-from-dateTime(

xs:dateTime("2007-07-30T14:30:00-05:00")

)

Results in: 7.

The normalisation of the value by subtracting the timezone difference does not cause a change of the day component (T14:30:00 -(-5:00) results in T19:30:00). The value of the month component is outputted unchanged.

Example 2 - month component from timestamp value with date jump:

fn:month-from-dateTime(

xs:dateTime("2007-12-31T19:20:00-05:00")

)

Results in: 1.

The normalisation (which corresponds to the subtraction of -5:00 hours from the daytime component T20:00:00) causes a date jump to the next day to 1.1.2008, 01:00:00. Consequentially, 1 is outputted as value of the month component.

Function definition:

XPath 1.0:

The function is not available.

XPath 2.0:

fn:month-from-dateTime($arg as xs:dateTime?) as xs:integer?

   

<< back next >>

 

 

 


Copyright © Galileo Press, Bonn 2008
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSLT 2.0 & XPath 2.0" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.


Galileo Press, Rheinwerkallee 4, 53227 Bonn, Germany