I need to get the last day of the month given as a date in SQL. If I have the first day of the month, I can do something like this:
DATEADD(DAY, DATEADD(MONT
Works in SQL server
Declare @GivenDate datetime SET @GivenDate = GETDATE() Select DATEADD(MM,DATEDIFF(MM, 0, @GivenDate),0) --First day of the month Select DATEADD(MM,DATEDIFF(MM, -1, @GivenDate),-1) --Last day of the month