Name

YEAR()

Synopsis

YEAR(date)

Returns the year for date in the range 1000 to 9999, or 0 for the zero date. This code returns the year 1999:

SELECT YEAR('1999-08-07');

Get Learning PHP, MySQL, and JavaScript 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.