开发者

Calculate fiscal year and quarter

How should I write a function to calculate the fiscal year an开发者_运维知识库d the quarter when user provides a date.Please reply soon.


Different companies start the fiscal year on different dates so the specifics of the implementation will depend on the specifics of how your company defines the fiscal year. If, for example, fiscal year 2012 starts June 1, 2011

SELECT to_char( add_months( <<input date>>, 7 ), 'YYYY' ) fiscal_year,
       to_char( add_months( <<input date>>, 7 ), 'Q' ) fiscal_quarter
  FROM dual;

If your company starts the fiscal year at a different point, you'd adjust the 7 month offset to whatever offset gets you to January 1 of the next calendar year.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜