Get the last day of the month in SQL

From SQL Server 2012 you can use the EOMONTH function.

Returns the last day of the month that contains the specified date,
with an optional offset.

Syntax

EOMONTH ( start_date [, month_to_add ] ) 

How … I can find the last day of the month for any given date?

SELECT EOMONTH(@SomeGivenDate)

Leave a Comment