DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: how to find last day of quarter

Hybrid View

  1. #1
    Join Date
    Oct 2000
    Posts
    139

    how to find last day of quarter

    Hi

    Does anyone know how can we find the last day of a quarter? For example we are in second quarter right now and I need to get the last day of June

    Thanx

  2. #2
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    Code:
    select
      case
        when mod(to_number(to_char(sysdate, 'mm')), 3) = 2
        then last_day(add_months(sysdate, 1))
        when mod(to_number(to_char(sysdate, 'mm')), 3) = 1
        then last_day(add_months(sysdate, 2))
        when mod(to_number(to_char(sysdate, 'mm')), 3) = 0
        then last_day(sysdate)
      end
    from dual;

  3. #3
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Code:
    SELECT LAST_DAY( TO_DATE( TO_CHAR( :input_date, 'Q')*3, 'MM')) AS last_q_day
    FROM dual;
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  4. #4
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    select trunc(add_months(sysdate,3),'Q')-1 from dual
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

Posting Permissions

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


Click Here to Expand Forum to Full Width