Collections:
YEAR() - Year of Date
How to extract the year from a given date using the YEAR() function?
✍: FYIcenter.com
YEAR(date) is a MySQL built-in function that
returns the year from a given date.
For example:
SELECT YEAR('2007-08-09'), YEAR(NOW()), NOW();
-- +--------------------+-------------+---------------------+
-- | YEAR('2007-08-09') | YEAR(NOW()) | NOW() |
-- +--------------------+-------------+---------------------+
-- | 2007 | 2023 | 2023-11-15 08:25:19 |
-- +--------------------+-------------+---------------------+
Reference information of the YEAR() function:
YEAR(date): int Returns the year for date, in the range 1000 to 9999, or 0 for the “zero” date. Arguments, return value and availability: date: Required. The date to extract the year from. int: Return value. The year of date. Available since MySQL 4.
Related MySQL functions:
⇒ YEARWEEK() - Year Week Combination
⇐ WEEKOFYEAR() - Calendar Week of Year
2023-11-17, 1881🔥, 0💬
Popular Posts:
How To Get Help Information from the Server in MySQL? While you are at the "mysql>" prompt, y...
Collections: Interview Questions MySQL Tutorials MySQL Functions Oracle Tutorials SQL Server Tutoria...
Can Date and Time Values Be Converted into Integers in SQL Server Transact-SQL? Can date and time va...
How To Fix the INSERT Command Denied Error in MySQL? The reason for getting the "1142: INSERT comman...
How To Connect to a MySQL Server with a Port Number in MySQL? If you want to connect a MySQL server ...