- Instant help with your Sql coding problems

Get current year in MySQL

How to get current year in MySQL?
SELECT id, deadline, YEAR(CURDATE()) AS 'currentYear' 
FROM task WHERE YEAR(deadline) = YEAR(CURDATE());

In case you only want to know the actual year without month and day use the built-in YEAR() function with CURDATE() as the parameter.

YEAR() returns the year for date, in the range 1000 to 9999, or 0 for the “zero” date. Returns NULL if date is NULL.

YEAR reference
Share "How to get current year in MySQL?"