[SalesForce] How to get end date for Current Fiscal Quarter in apex

wanted to get end date for Current Fiscal Quarter in apex any ideas, how to get this information.

Best Answer

Here is the simplest way I getting date I believe - We just need to query Period Object record and thats it. I think most of us are not aware of this Object in salesforce.com

Date closeDate = [Select EndDate From Period Where type = 'Quarter' and StartDate = THIS_FISCAL_QUARTER].EndDate;