Skip to main content
Version: Stable-3.1

year

Description

Returns the year part in a date and returns a value that ranges from 1000 to 9999.

The date parameter must be of the DATE or DATETIME type.

Syntax

INT YEAR(DATETIME date)

Examples

MySQL > select year('1987-01-01');
+-----------------------------+
| year('1987-01-01 00:00:00') |
+-----------------------------+
| 1987 |
+-----------------------------+

keyword

YEAR