Something I notice a lot of people forget is to get the last day of the month you just need to find the first day of next month and subtract one.
DECLARE @IDate Date = GETDATE()
Select @IDate, DATEADD(D,-1,DATEADD(M, DATEDIFF(M, -1, @IDate), 0)) IDateMonthLastDay