XPath/XQuery dateTime function

Summary

Returns an xs:dateTime value created by combining an xs:date and an xs:time.

Signature

fn:dateTime(
$arg1 as xs:date?,
$arg2 as xs:time?
) as xs:dateTime?

Properties

This function is deterministic, context-independent, and focus-independent.

Rules

If either $arg1 or $arg2 is the empty sequence the function returns the empty sequence.

Otherwise, the function returns an xs:dateTime whose date component is equal to $arg1 and whose time component is equal to $arg2.

The timezone of the result is computed as follows:

  • If neither argument has a timezone, the result has no timezone.

  • If exactly one of the arguments has a timezone, or if both arguments have the same timezone, the result has this timezone.

Examples

The expression fn:dateTime(xs:date("1999-12-31"), xs:time("12:00:00")) returns xs:dateTime("1999-12-31T12:00:00").

The expression fn:dateTime(xs:date("1999-12-31"), xs:time("24:00:00")) returns xs:dateTime("1999-12-31T00:00:00").

Error Conditions

A dynamic error is raised if the two arguments both have timezones and the timezones are different.