SQL to Determine if A Date Is A Month End Date

If you need to determine if a date is a month end date, or you just need to know what the month end date is for a given date field, use this:

DATEADD(dd, -1, DATEADD(mm, +1, DATEADD(dd, 1 - DATEPART(dd, @Date), @Date)))

Replace "@date" with your date field.

This returns the month end date for the date you have used. So, if you replace "@date" with a field that contains "02/15/2013", it will return the month end date "02/28/2013".