Get current year in MySQL
Question: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.
Share "How to get current year in MySQL?"
Tags:current year, actual year, get year, get current year, mysql
Technical term:Get current year in MySQL