fn:year-from-date function

The fn:year-from-date function returns the year component of an xs:date value that is in its localized form.

Syntax

Read syntax diagramSkip visual syntax diagramfn:year-from-date( date-value)
date-value
The date value from which the year component is to be extracted.

date-value is of type xs:date, or is an empty sequence.

Returned value

If date-value is of type xs:date, the returned value is of type xs:integer, The value is the year component of the date-value, a non-negative value.

If date-value is an empty sequence, the returned value is an empty sequence.

Example

The following function returns the year component of the date value for October 29, 2009.

fn:year-from-date(xs:date("2009-10-29"))

The returned value is 2009.