How to display SQL Server date full month name? Which is to say with the complete month names like January, February, March, April, May, etc. written out in full. This query shows you how to get the full month names from the current date or any other date.
Indeed, with a simple SELECT GETDATE() you can display easily the current date. SQL Server provides a lot, really a lot of options to display the dates. It’s linked to the big variety of date format available in the countries around the world. You might need just a simple date, or you may need a complete timestamp, for example to record sales transactions.
How to display SQL Server date full month name
This SQL Server query displays the Month name using the DATENAME() SQL Server built-in function that displays month in letters based on the month contained in a date or a timestamp. Indeed the tip is to use the DATENAME() function with the MONTH keyword and the GETDATE() time function to return the date of the day. In our example, we use the current date, but it works with “hard-coded” dates too.
The query below is using the MONTH options provided by the DATENAME() SQL Server built-in function.
SELECT DATENAME(MONTH, GETDATE() ) AS [MonthName], GETDATE() AS [CurrentDate]
For example, it returns “June” for today.
The query also works the same way for the day number and the year number.
SELECT DATENAME(YEAR, GETDATE() ) AS [MonthName], GETDATE() AS [CurrentDate]; SELECT DATENAME(DAY, GETDATE() ) AS [MonthName], GETDATE() AS [CurrentDate];
The result is 2018 for the first query. The result is 11 for the second query. Supposing that you are the 11th June 2018.
I showed you how to display the full month name from an SQL Server date.
Another post shows how to calculate a date difference with the hours, minutes and seconds.
Don’t hesitate to get in touch to share your comments and appreciations on the blog.
I’d like to hear from you!