It returns the last day of the month for the given date with an optional offset.
Syntax : EOMONTH ( start_date [, month_to_add ] )
It returns date type.
Example 1:
DECLARE @date DATETIME
SET @date = ’12/1/2011′
SELECT EOMONTH ( @date) AS LastDateOfTheMonth
GO
Example 2: Using offset
DECLARE @date DATETIME
SET @date = ’12/1/2011′
SELECT EOMONTH ( @date, 1) AS LastDateOfTheMonth
GO
