How to Use the YEAR() Function in SQL Server: A Complete Guide

Rumman Ansari   Software Engineer   2024-07-21 09:42:46   5820  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:

Syntax:


Year()

Returns the 'Year number' of the given date.

Code:


Select Year(GETDATE()) 

Returns the year number, based on the current system date.


Select Year('01/31/2019')

Output:

The above code will produce the following result-


2019



Stay Ahead of the Curve! Check out these trending topics and sharpen your skills.