[SalesForce] Current Fiscal Year in apex

I need to check if close date of opportunity is equal to current fiscal year in apex.Can someone explain me how to use get current fiscal year.FYI my Org doesn't have custom Fiscal year setup.(Its Standard Fiscal year).

Best Answer

You can get the month of your organisation fiscal year with this query :

Integer orgFiscalMonth = [SELECT FiscalYearStartMonth FROM Organization].FiscalYearStartMonth;

And create a Date variable using this :

Date orgFiscalYear = Date.newinstance(system.today().year(), orgFiscalMonth, 1);
Related Topic