Link Search Menu Expand Document

TO_YEAR

Converts a date or timestamp (any date format we support) to a number containing the year.

Syntax

TO_YEAR(<date>)
Parameter Description
<date> The date or timestamp to be converted into the number of the year.

Example

For Tuesday, April 22, 1975:

SELECT
	TO_YEAR(CAST('1975/04/22' AS DATE)) as res;

Returns: 1975