XPath/XQuery dateTime-equal function

Summary

Returns true if the two supplied xs:dateTime values refer to the same instant in time.

Operator Mapping

Defines the semantics of the "eq" operator when applied to two xs:dateTime values. Also used in the definition of the "ne", "le" and "ge" operators.

Signature

op:dateTime-equal(
$arg1 as xs:dateTime,
$arg2 as xs:dateTime
) as xs:boolean

Properties

This function is deterministic, context-dependent, and focus-independent. It depends on implicit-timezone.

Rules

If either $arg1 or $arg2 has no timezone component, the effective value of the argument is obtained by substituting the implicit timezone from the dynamic evaluation context.

The function then returns true if and only if the effective value of $arg1 is equal to the effective value of $arg2 according to the algorithm defined in section 3.2.7.4 of Order relation on dateTime for xs:dateTime values with timezones. Otherwise the function returns false.

Examples

Assume that the dynamic context provides an implicit timezone value of -05:00

The expression op:dateTime-equal(xs:dateTime("2002-04-02T12:00:00-01:00"), xs:dateTime("2002-04-02T17:00:00+04:00")) returns true().

The expression op:dateTime-equal(xs:dateTime("2002-04-02T12:00:00"), xs:dateTime("2002-04-02T23:00:00+06:00")) returns true().

The expression op:dateTime-equal(xs:dateTime("2002-04-02T12:00:00"), xs:dateTime("2002-04-02T17:00:00")) returns false().

The expression op:dateTime-equal(xs:dateTime("2002-04-02T12:00:00"), xs:dateTime("2002-04-02T12:00:00")) returns true().

The expression op:dateTime-equal(xs:dateTime("2002-04-02T23:00:00-04:00"), xs:dateTime("2002-04-03T02:00:00-01:00")) returns true().

The expression op:dateTime-equal(xs:dateTime("1999-12-31T24:00:00"), xs:dateTime("2000-01-01T00:00:00")) returns true().

The expression op:dateTime-equal(xs:dateTime("2005-04-04T24:00:00"), xs:dateTime("2005-04-04T00:00:00")) returns false().