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, 1196🔥, 0💬
Popular Posts:
What Privilege Is Needed for a User to Delete Rows from Tables in Another Schema in Oracle? For a us...
What are binary literals supported in SQL Server Transact-SQL? Binary literals in Transact-SQL are s...
Where to find SQL Server Transact-SQL language references? You can find SQL Server Transact-SQL lang...
How To Calculate Age in Days, Hours and Minutes in SQL Server Transact-SQL? On many Web sites, news ...
Where to find answers to frequently asked questions on Transaction Management: Commit or Rollback in...