How To Get Name of Month In SQL Server?

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

Reference


Leave your thoughts...

This site uses Akismet to reduce spam. Learn how your comment data is processed.