MS Access Month() Function
The Month()
function in MS Access extracts the month component from a date value. It's a handy function for working with date data and performing date-based analysis or filtering.
Month(): Definition and Usage
This function takes a date value as input and returns an integer representing the month. January is 1, February is 2, and so on, up to December (12).
Syntax
Syntax
Month(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 that evaluates to a date). This is required. |
Examples
Extracting the Month from a Specific Date
This example extracts the month from the date May 17th, 2017.
Syntax
SELECT Month(#05/17/2017#);
Output
5
Extracting the Month from Today's Date
This example gets the current month.
Syntax
SELECT Month(Date());
Output
(The current month as an integer, e.g., 10 for October)
Extracting the Month from a Table Column
This example retrieves the birth month for each employee from the 'Employees' table.
Syntax
SELECT Month(BirthDate) FROM Employees;
Output
(A list of integers representing the birth months of all employees.)