MS Access Year() Function
The Year() function in MS Access extracts the year from a date value. This is a very useful function for working with date data and performing date-based analysis or filtering.
Year(): Definition and Usage
This function takes a date value as input and returns an integer representing the year. The returned year will be a four-digit number between 100 and 9999. It's commonly used to filter data based on specific years, to group data by year, or to perform year-related calculations.
Syntax
Syntax
Year(date)
      
    Parameter Values
| Parameter | Description | 
|---|---|
date | 
          A date value (can be a date literal like #05/17/2017#, a date field from a table, or an expression resulting in a date).  This is required. | 
        
Examples
Extracting the Year from a Specific Date
This example extracts the year from May 17th, 2017.
Syntax
SELECT Year(#05/17/2017#);
      
    Output
2017
      
    Extracting the Year from Today's Date
This example gets the current year.
Syntax
SELECT Year(Date());
      
    Output
2024  (or the current year)
      
    Extracting the Year from a Table Column
This example retrieves the birth year for each employee from the 'Employees' table (assuming a table named 'Employees' exists with a 'BirthDate' column).
Syntax
SELECT Year(BirthDate) FROM Employees;
      
    Output
(A list of years representing the birth years of all employees.)