-
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
-
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;
-
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?
-
select trunc(add_months(sysdate,3),'Q')-1 from dual
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|