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, 1093🔥, 0💬
Popular Posts:
How To Start MySQL Server in MySQL? If you want to start the MySQL server, you can run the "mysqld" ...
How To Insert New Line Characters into Strings in SQL Server Transact-SQL? If you want to break a st...
What Privilege Is Needed for a User to Delete Rows from Tables in Another Schema in Oracle? For a us...
How To Fix the INSERT Command Denied Error in MySQL? The reason for getting the "1142: INSERT comman...
How To Generate CREATE VIEW Script on an Existing View in SQL Server? If you want to know how an exi...