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-date

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 date value passed on.

Call/Arguments:

fn:month-from-date($dateValue)

$dateValue:

Optional. A date value of xs:date 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 explicit timezone indication, the value is accordingly normalised before the extraction of the component value.

During the normalisation, a date jump may occur if there is a positive timezone difference. This date jump possibly has also an effect on the value of the month component (see example 2).

Example 1 - month component from date:

fn:month-from-date(

xs:date("2007-07-30-05:00")

)

Results in: 7.

In this case, the normalisation of the value does not cause a change of the day component. The value of the month component is accordingly outputted unchanged.

Example 2 - month component from date with date jump:

fn:month-from-date(

xs:date("2008-01-01+05:00")

)

Results in: 12.

The normalisation (which corresponds to the subtraction of +5:00 hours from the implicit daytime component T00:00:00) causes a date jump to the previous day to 31.12.2007, 19:00:00. Consequentially, 12 is outputted as value of the month component.

Function definition:

XPath 1.0:

The function is not available.

XPath 2.0:

fn:month-from-date($arg as xs:date?) 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