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

(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-time

Category:

Context information – date and time

Origin:

XPath 2.0

Return value:

The daytime in the xs:time format being current for the evaluation context.

Call/Arguments:

fn:current-time()

No arguments.

Purpose of use:

The fn:current-time() function is called up without passing on an argument. The time 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 the daytime calculated from the system time. The value may contain the implicit timezone as a timezone indication.

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

Example 1 - timestamp value with timezone:

fn:current-time() returns: 20:48:10.553+12:00.

Dependent on the context, the function returns the current time value - here with a timezone indication.

Example 2 - date without timezone:

fn:current-time() returns: 20:48:10.553Z.

If no implicit timezone is indicated, the mere time 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-time() as xs:time

   

 

 

 

back to top