Thursday, August 14, 2014

How to get date based on fiscal year,quarter or month

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

Date startDate = [Select StartDate From Period Where type = 'Month' and StartDate = THIS_FISCAL_Month].StartDate;

Date startDate = [Select StartDate From Period Where type = 'Year' and StartDate = THIS_FISCAL_Year].StartDate;

The above will get you the current start date for the custom fiscal year.
Note: Custom fiscal year has to be setup if you want any results.

No comments:

Post a Comment