What's the most efficient way to calculate the last day of the prior quarter?
Example: given the date 11/19/2008, I want to return 9/30/2008.
Platform is SQL Server
If @Date has the date in question
Select DateAdd(day, -1, dateadd(qq, DateDiff(qq, 0, @Date), 0))
EDIT: Thanks to @strEagle below, simpler still is:
Select dateadd(qq, DateDiff(qq, 0, @Date), -1)
1.4m articles
1.4m replys
5 comments
57.0k users