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
Printable View
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;
select trunc(add_months(sysdate,3),'Q')-1 from dual