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:day-from-dateTime
Category:
Value extraction from time values, date values and duration
Origin:
XPath 2.0
Return value:
An integer of xs:integer type corresponding to the value of the day component within the timestamp value passed on.
Call/Arguments:
fn:day-from-dateTime($timestampValue)
$timestampValue:
Optional. A timestamp value of xs:dateTime type which may include a timezone indication. If the empty sequence is passed on, the function also returns the empty sequence.
Purpose of use:
The function returns an integer between 1 and 31 inclusive which corresponds to the value of the day component of the timestamp value passed on of xs:dateTime type. The value is first normalised, which means the timezone factor is integrated into the day component (see examples). This may cause a date jump to the previous or the next day, provided that the normalised daytime portion falls below the value T00:00:00 or exceeds the value T23:59:59 because of the timezone correction factor. In this case, a value other than the possibly expected is outputted (see example 3).
Example 1 - day from timestamp value with negative timzone value:
xs:dateTime("2007-07-25T12:30:00-05:00")
)
returns the value 25. In this example, the negative timezone value causes no jump of the date. The subtraction causes a normalised daytime component of T17:30:00.
Example 2 - day from timestamp value with negative timezone value:
xs:dateTime("2007-08-01T04:30:00-05:00")
)
returns 1. In this example, the negative timezone value causes no jump of the date. The subtraction T04:30:00 -(-5:00) causes a normalised daytime component of T09:30:00.
Example 3 - day from timestamp value with positive timezone value:
xs:dateTime("2007-08-01T04:30:00+05:00")
)
returns the value 31 and not 1, as might be expected. The positive timezone is subtracted during the normalisation: T04:30:00 -(+5:00) and causes a date jump to the previous day – in this example to the 31st of the previous month.
Function definition:
XPath 1.0:
The function is not available.
XPath 2.0:
fn:day-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