XML technologies / XSLT / XSLT and XPath functions / Alphabetical XSLT and XPath reference / current-dateTime

(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:current-dateTime

Category:

Context information – date and time

Origin:

XPath 2.0

Return value:

The date value with daytime portion in the xs:dateTime format being current for the evaluation context.

Call/Arguments:

fn:current-dateTime()

No arguments.

Purpose of use:

The fn:current-dateTime() function is called up without passing on an argument. The timestamp value returned by the function is dependent on the valid context at the time of the evaluation of the appropriate XPath expression.

During a XSLT transformation, the function usually returns a timestamp value calculated from the system date and the system time. The value may contain the implicit timezone as a timezone indication.

The function is stable and therefore returns during an ongoing transformation a constant value.

Example 1 - timestamp value with timezone in the function context:

fn:current-dateTime() returns: 2007-07-10T20:48:10.553+12:00.

The function returns the current timestamp value in a context-dependent way – here with a timezone indication.

 

Example 2 - timestamp value without timezone in the function context:

fn:current-dateTime() returns: 2007-07-10T20:48:10.553Z.

If there is no implicit timezone, the mere timestamp value is returned – in this case with a postpositioned Z.

Function definition:

XPath 1.0:

The function is not available.

XPath 2.0:

fn:current-dateTime() as xs:dateTime

   

 

 

 

back to top