Reputation: 45
I'm trying to write a query which will show me the first date and last date of the current quarter.
It would be similar to the below:
SELECT
TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE, 'Q'), 0), 'DD/MM/YYYY') AS output_from_date
FROM dual;
Upvotes: 1
Views: 748
Reputation: 58892
You can add the last date, by getting first day of next quarter (plus 3 month) minus 1:
SELECT TRUNC(SYSDATE, 'Q') AS first_quarter_date,
ADD_MONTHS(TRUNC(SYSDATE, 'Q'), 3) -1 AS last_quarter_date
from dual;
Upvotes: 1