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



Value extraction from time values, date values and duration


XPath 2.0

Return value:

A xs:decimal decimal number which corresponds to the value of the seconds and split seconds of the timestamp value passed on in its normalised form.




Optional. A timestamp value of xs:dateTime type which may include a timezone indication. If the empty sequence is passed on, the function returns an empty result sequence.

Purpose of use:

The function returns a decimal number between 0 and 60.99 (not 59.99, see below!) which corresponds to the value of the seconds component and its fractions of the timestamp value passed on. The value passed on must be formally normalised, which means an implicitly or explicitly existing timezone indication must be included. However, this has no influence on the value of the seconds component.

Theoretically, the value may exceed the number of 60 seconds because, occassionally, leap seconds are inserted in order to adjust the official timing to the irregularities of the rotation of the earth. However, this only happens on 30 June or on 31 December at 23:59:59 UTC. Accordingly, a value greater than 60 is extremely rare.


Since 1967 a second as SI (International System of Units) base unit is no longer defined as fraction of a day, but via a resonance of the caesium atom. Because the rotation of the earth is less evenly, the so-called leap seconds are necessary for the alignment to the standard time (in Germany they are determined by the Physikalisch-Technische Bundesanstalt). This is accomplished by the adoption of the leap seconds internationally specified by the International Earth Rotation and Reference Systems Service. On average, an adjustment is required once a year. A synchronisation of computers with the standard time is enabled by the Network Time Protocol (NTP) by means of the appropriate NTP server.

Example 1 – seconds from timestamp value:


results in: 45. The value of the seconds component can be found directly.

Example 2 – seconds from timestamp value:


results in: 45. The explicit timezone indication requires, in principle, a normalisation which, however, in this example has no influence on the value of the seconds component (but on the value of the hours component).

Function definition:

XPath 1.0:

The function is not available.

XPath 2.0:

fn:seconds-from-dateTime($arg as xs:dateTime?) as xs:decimal?


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