How to display the full month name from a date with a SQL Server query?
The T-SQL langage provides several ways to display the month name in SQL Server. It allows various formats such as in all letters, abbreviated form, or in different languages. One popular approach is to use the DATENAME() function with the MONTH keyword to retrieve the full or abbreviated month name. By passing the current date or any other date as a parameter, you can retrieve the entire month names.
These script examples are helpful when you need to display the month names in a report or a chart. In the next sections, we will explore other ways to display the month name in SQL Server, such as by using the month number or by displaying the month name in different languages. To display the month name in SQL Server, you can use the DATENAME() SQL Server built-in function. This function can display the month in letters based on the month contained in a date or a timestamp. To retrieve the current date or a hard-coded date, you can use the GETDATE() time function.
By using the DATENAME() function with the MONTH keyword and the GETDATE() time function, you can easily display the month name in SQL Server. This method can be used to display the month name in various formats and languages, depending on your needs.
Table of Contents
1. T-SQL simple query to display the month name in all letters
The query below simply shows the month name using the MONTH option and the current timestamp with the default output format.
SELECT DATENAME(MONTH, GETDATE() ) AS [MonthName], GETDATE() AS [CurrentDate];
For example, it returns “June” in all letters for today.

To sum up, this short tutorial explains how to display the full month name in all letters from a SQL date.
Another post shows how to calculate a date difference with the hours, minutes and seconds.
2. Display the full month name in English
One way to display the month name in SQL Server is by showing the full month name in English. This method can be helpful in situations where you need to display the month name in a more formal manner, such as in a report or a document. By using the DATENAME() function with the MONTH keyword and the FORMAT() function with the ‘MMMM’ specifier, you can easily retrieve the full month name in English.
SELECT FORMAT(DATENAME(MONTH, GETDATE()), 'MMMM') AS [FullMonthName];
This query simply returns the full month name, such as “January” or “December”.
3. Display the month abbreviation in English
Another way to display the month name in SQL Server is by showing the month abbreviation in English. This method can be useful when you need to display the month name in a shorter format, such as in a table or a chart. To achieve this, you can use the DATENAME() function with the MONTH keyword and the FORMAT() function with the ‘MMM’ specifier.
This will return the month abbreviation in English, such as “Jan” for January or “Dec” for December. This method is also helpful when you need to group the dates by month. By displaying the month abbreviation, you can easily group the dates without taking up too much space. In the next sections, we will explore how to display the month name in different formats and languages.
SELECT FORMAT(DATENAME(MONTH, GETDATE()), 'MMM') AS [MonthAbbreviation];
The code above returns the month abbreviation, such as “Jan” or “Dec”.
4. Display the full month name in Spanish
SET LANGUAGE 'Spanish'; SELECT FORMAT(DATENAME(MONTH, GETDATE()), 'MMMM') AS [FullMonthName];
This will return the full month name in Spanish, such as “enero” or “diciembre”.
5. Display the month abbreviation in French or in Spanish
To display the month abbreviation in French or in Spanish, you can use the FORMAT() function with the appropriate language specifier. This method can be helpful when you need to display the month abbreviation in a specific language or format, such as in a report or a chart.
In the following paragraph, we will provide an example of how to modify the script to display the month abbreviation in French or in Spanish. Hence, to display the month abbreviation in Spanish or in French, you can modify the script as follows:
5.1 Month abbreviation in Spanish
DECLARE @date datetime = '2023-01-01'; SELECT FORMAT(@date, 'MMMM', 'en-US') AS 'en-US', FORMAT(@date, 'MMMM', 'es-ES') AS 'es-ES', FORMAT(@date, 'MMMM', 'es-ES') AS 'es-ES-Traditional';
In this modified script, we added a new line that uses the ‘es-ES-Traditional’ specifier to return the month name in Spanish using traditional month names. For example, instead of returning “enero” for January, it will return “Enero” with a capital letter.
5.2 Month abbreviation in French
DECLARE @date datetime = '2023-01-01'; SELECT FORMAT(@date, 'MMMM', 'en-US') AS 'en-US', FORMAT(@date, 'MMMM', 'fr-FR') AS 'fr-FR', FORMAT(@date, 'MMMM', 'fr-CA') AS 'fr-CA';
In this modified script, we added a new line that uses the ‘fr-CA’ specifier. It returns the month name in French for Canadian French. This is because Canadian French has different month names than standard French. By using the ‘fr-CA’ specifier, the month names will be displayed in the correct format for Canadian French.
6. Displaying the month number with T-SQL
Another way to display the month in SQL Server is by showing the month number. This method can be helpful when you need to perform calculations or sorting by month. To display the month number, you can use the DATEPART() function with the MONTH keyword. This will return the month number as an integer value, such as 1 for January or 12 for December.
You can use this method in combination with other functions to retrieve the month name in different formats or languages. For example, you can use a CASE statement to display the month name based on the month number. This last query will return the month number, such as 1 for January or 12 for December.
SELECT DATEPART(MONTH, GETDATE()) AS [MonthNumber];
7. Conclusion on displaying month names in T-SQL
In conclusion, displaying the month name in SQL Server can be achieved using various methods depending on your specific needs. Whether you want to display the full month name, the month abbreviation, or the month number, SQL Server provides built-in functions to retrieve the information you need. Additionally, you can use the FORMAT() function with language specifiers to display the month name in different languages.
By combining these methods, you can display the month name in various formats and languages, depending on your needs. These functions can be useful when you need to create reports, charts, or perform calculations based on the month. With the examples provided in this tutorial, you should have a good understanding of how to display the month name in SQL Server. So go ahead and try them out! Additionally, if you ever need to calculate the time difference between two dates with accuracy, including hours, minutes, seconds, and sometimes milliseconds, you can check out our tutorial on how to calculate the date difference in SQL Server.
Another common challenge is to calculate the time difference between two dates, with accuracy, i.e. including the hours, minutes, seconds and sometime milliseconds.
By the way, we’d like to hear from you! Please do not hesitate to leave a comment or to contact us.