How to Get the Year from a Date in T-SQL Database: MS SQL Server Operators: YEAR() Table of Contents Problem Example Solution Discussion Problem You’d like to get the year from a date field in a SQL Server database. Example Our database has a table named Children with data in the columns Id, FirstName, LastName, and BirthDate. IdFirstNameLastNameBirthDate 1JaneSmith2018-06-20 2GaryBrown2010-02-02 3LoraAdams2014-11-05 Let’s get the year from each child’s birthdate. Solution We’ll use the YEAR() function. Here’s the query you would write: SELECT FirstName, LastName, YEAR(BirthDate) AS BirthYear FROM Children; Here’s the result of the query: FirstNameLastNameBirthYear JaneSmith2018 GaryBrown2010 LoraAdams2014 Discussion Use SQL Server’s YEAR() function if you want to get the year part from a date. This function takes only one argument – a date, in one of the date and time or date data types. (In our example, the column BirthDate is a date data type). The argument can be a column name or an expression. (In our example, the argument is the BirthDate column.) The YEAR() function returns an integer. For Jane Smith, it returns the integer 2018 from the birth date '2018-06-20'. Recommended courses: SQL Basics in SQL Server Common Functions in SQL Server Recommended articles: SQL Server Cheat Sheet Top 29 SQL Server Interview Questions How to Learn T-SQL Querying 18 Useful Important SQL Functions to Learn ASAP Performing Calculations on Date- and Time-Related Values See also: How to Remove Leading and Trailing Spaces in T-SQL How to Get the Month from a Date in T-SQL How to Group by Month in T-SQL How to Group by Year in T-SQL How to Order by Date in T-SQL How to Format a Date in T-SQL Subscribe to our newsletter Join our monthly newsletter to be notified about the latest posts. Email address How Do You Write a SELECT Statement in SQL? What Is a Foreign Key in SQL? Enumerate and Explain All the Basic Elements of an SQL Query