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, 1506🔥, 0💬
Popular Posts:
How To Format Time Zone in +/-hh:mm Format in SQL Server Transact-SQL? From the previous tutorial, y...
How To Concatenate Two Character Strings Together in SQL Server Transact-SQL? Concatenating two char...
What is test testing area for? The testing area is provided to allow visitors to post testing commen...
How To Start the Command-Line SQL*Plus in Oracle? If you Oracle server or client installed on your w...
Where Is the Export Dump File Located in Oracle? If you are not specifying the dump directory and fi...