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:dateTime
Category:
Value extraction from time values, date values and duration
Origin:
XPath 2.0
Return value:
A timestamp value xs:dateTime which is generated from the individual components passed on.
Call/Arguments:
fn:dateTime($dateValue, $timeValue)
$dateValue:
A date value of xs:date type. The empty sequence is permitted as argument – in this case, the function returns an empty result sequence.
$timeValue:
A daytime indication of xs:time type. The empty sequence is permitted as argument – in this case, the function returns an empty result sequence.
Purpose of use:
The fn:dateTime function constructs a timestamp value of xs:dateTime type from the individual components of xs:date and xs:time type passed on to the function as arguments. Both values passed on have to correspond to the timezones. If the empty sequence is passed on instead of one or both arguments, the function returns an empty result sequence.
The result value has the same timezone like the arguments, provided that the timezone is the same for both arguments or only one of the arguments has a timezone indication.
If both arguments have timezone indications, but these do not match, the error »Both arguments to fn:dateTime have a specified timezone« is reported (err:FORG0008).
Example 1 - construction of a timestamp value:
fn:dateTime( xs:date('2007-12-31'),
xs:time('12:00:00')
)
Results in: xs:dateTime('2007-12-31T12:00:00'). The result value, like the input arguments, has no timezone indication.
Example 2 - construction of a timestamp value with timezone:
fn:dateTime( xs:date('2007-07-25-05:00'),
xs:time('12:00:00')
)
Results in: xs:dateTime('2007-12-31T12:00:00-05:00'). The first argument has a timezone indication which, as a consequence, appears in the result.
Example 3 - construction of a timestamp value with timezone:
fn:dateTime( xs:date('2007-07-25-05:00'),
xs:time('12:00:00-05:00')
)
Results in: xs:dateTime('2007-12-31T12:00:00-05:00'). Here, both arguments have the same timezone indication which also appears in the result.
Example 4 - error because of an incorrect timezone indication:
fn:dateTime( xs:date('2007-07-25-05:00'),
xs:time('12:00:00+05:00')
)
Results in the error err:FORG0008 because the arguments have different timezone indications. The function cancels the processing without an output.
Function definition:
XPath 1.0:
The function is not available.
XPath 2.0:
fn:dateTime($arg1 as xs:date?, $arg2 as xs:time?) as xs:dateTime?
<< 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