fn:year-from-date

Return year integer value from date argument.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

fn:year-from-date(xs:date? $arg) => xs:integer?

Description

This function returns an integer value between 1 and 12, representing the year component of the localized value of the argument value. The localized value is the value in its original timezone or without timezone. The value may be negative. If the argument is an empty sequence, the empty sequence is returned.

Argument

$arg

argument value of type xs:date

Examples

  • This function call returns the year component of the current date:

    year-from-date(current-date())
  • This function call returns the year component of the specified date value which is 1999:

    year-from-date(xs:date("1999-05-31-05:00"))