In this article, I would like to show the functions Month and Eomonth in SQL Server. The Month and Emonth are part of the datetime functions. The Month Function returns an integer that represents the month of the specified date and similarly the Eomonth function returns the last day of the month that contains the specified date. So let's have a look at a practical example of how to use the Month and Eomonth functions in SQL Server 2012. The example is developed in SQL Server 2012 using SQL Server Management Studio.
The Month Function
The Month Function returns an integer that represents the month of the specified date.
Syntax
The syntax of the Month built-in date function is as follows :
MONTH ( Date )
Here, The <Date> parameter can be an expression, column expression, user-defined variable, or string literal.
Example
Select getdate() as CurrentDate
Go
Select month(getdate()) as Month



Join the conversation! Your thoughts help the community grow.