In my earlier article, we have seen how to get the day of week in name or number using the DATENAME and DATEPART inbuilt functions in SQL Server. Today we’ll see a simple tip on how to get the name of month using the same function DATENAME.
Syntax
DATENAME ( month , <date> )
Where the first parameter can be either month or mm or m. The second parameter should be a date datatype.
Example To Get Name of Month
SELECT DATENAME(month, GetDate())
/* Result */
June
![Get the name of month in SQL Server](https://www.mytecbits.com/wp-content/uploads/Get-Name-Of-Month.jpg)
Reference
- About the in-build function DATENAME at Microsoft Docs.