Table of Contents

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

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

    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