Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2010
    Posts
    7

    Unanswered: how to find current financial year

    how to find current financial year?

    please help me out.

  2. #2
    Join Date
    Mar 2007
    Posts
    623
    how to find current financial year?
    Easily - by applying rules for its obtaining it, as stated e.g. here: http://en.wikipedia.org/wiki/Fiscal_year
    Depending on your country, it is FY2011 or FY2012 now.

  3. #3
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Quote Originally Posted by flyboy View Post
    Depending on your country, it is FY2011 or FY2012 now.
    Doesn't this depend on the company, rather than the country?

  4. #4
    Join Date
    Dec 2010
    Posts
    7
    Financial year start from 01-Apr and ends to 31 -mar

    if date is 01-nov-2010 then financial year is 01-apr-2010 to 31-mar-2011

    if date is 01-feb-2011 then financial year is 01-apr-2010 to 31-mar-2011


    Please help me...

  5. #5
    Join Date
    Mar 2007
    Posts
    623
    This query may give you a clue. By subtracting 3 months (or adding 9 months), you will get the start/end date of calendar year. Just obtain the year number from it (as 01-apr and 31-mar are fixed):
    Code:
    -- start of some sample dates; use real table/variable(s) containing checked date(s) instead of this
    with samples as (select to_date( '01-apr-2010', 'dd-mon-yyyy' ) val from dual
           union all select to_date( '01-nov-2010', 'dd-mon-yyyy' ) from dual
           union all select to_date( '01-feb-2011', 'dd-mon-yyyy' ) from dual
           union all select to_date( '31-mar-2011', 'dd-mon-yyyy' ) from dual)
    -- end of sample dates, query for obtaining financial year (with intermediate results)
    select val, add_months( val, -3 ) start_year, add_months( val, 9 ) end_year,
      '01-apr-'||to_char( add_months( val, -3 ), 'yyyy' )||' to 31-mar-'||to_char( add_months( val, 9 ), 'yyyy' ) fy
    from samples;
    
    VAL         START_YEAR  END_YEAR    FY
    ----------- ----------- ----------- --------------------------
    01-apr-2010 01-jan-2010 01-jan-2011 01-apr-2010 to 31-mar-2011
    01-nov-2010 01-aug-2010 01-aug-2011 01-apr-2010 to 31-mar-2011
    01-feb-2011 01-nov-2010 01-nov-2011 01-apr-2010 to 31-mar-2011
    31-mar-2011 31-dec-2010 31-dec-2011 01-apr-2010 to 31-mar-2011

  6. #6
    Join Date
    Aug 2009
    Location
    Olympia, WA
    Posts
    337
    Create a function to compare the current month with the first month of the fiscal year. Something like so.
    Code:
    CREATE OR REPLACE FUNCTION fiscal_year(
        p_date DATE, 
        p_first_mon NUMBER DEFAULT 7  -- Here July is the 1st month of new fiscal year
    ) RETURN NUMBER AS
    BEGIN
      RETURN EXTRACT(YEAR FROM p_date) + 
        CASE WHEN EXTRACT(MONTH FROM p_date) >= p_first_mon THEN 1 ELSE 0 END;
    END;
    I added the p_first_mon parameter so you could also figure out the fiscal year for other locales. But it sounds like you would want to use 4 for April.
    Last edited by artacus72; 12-21-10 at 19:51.

  7. #7
    Join Date
    Dec 2010
    Posts
    7
    Thanx flyboy

    Got solution...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •