THE WORLD'S LARGEST WEB DEVELOPER SITE

SQL Server YEAR() Function

❮ SQL Server Functions

Example

Return the year for a given date:

SELECT YEAR('2017/08/25') AS Year;
Try it Yourself »

Definition and Usage

The YEAR() function returns the year (as a four-digit number) for a given date.

Syntax

YEAR(date)

Parameter Values

Parameter Description
date Required. The date to return the year from

Technical Details

Works in: SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005

More Examples

Example

Return the year for a given date:

SELECT YEAR('1998/05/25 09:08') AS Year;
Try it Yourself »

❮ SQL Server Functions