Retrieve the numerical year component from a date.
SELECT YEAR(‘2017/08/25’) AS Year; |
The YEAR() function retrieves the numeric representation of the year from a given date.
YEAR(date) |
Parameter |
Description |
date |
Mandatory. The date or datetime value from which the year is to be extracted. |
Return type: |
int |
Works in: |
SQL Server (from 2008 onward), Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse |
Retrieve the numeric year component from a date.
SELECT YEAR(‘1998/05/25 09:08’) AS Year; |