SQL Date Function YEAR()
The YEAR() function is a SQL function used to extract the year component of a date or datetime value. It takes one argument, which is the date or datetime value from which the year component will be extracted.
Here's an example of how to use the YEAR() function in a SQL query:
SELECT YEAR('2022-02-28');Source:www.theitroad.com
This query will return the integer value 2022, which is the year component of the date "2022-02-28".
Note that the YEAR() function is specific to the database management system you are using, and the syntax and date format it supports may vary slightly depending on the system. Additionally, the YEAR() function only extracts the year component of a date or datetime value, and does not take into account other components such as the month or day.