Name

YEAR( )

Synopsis

YEAR(date)

This function returns the year of the given date provided. It returns values from 1,000-9,999.

SELECT YEAR('2005-01-01')
       AS 'Year';
+------+
| Year |
+------+
| 2005 |
+------+

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.