Write a SQL Query to get the Quarter from date.

Answer: We can use to_char function with ‘Q’ option for quarter to get quarter from a date.

Use TO_CHAR with option ‘Q’ for Quarter

SELECT TO_CHAR(TO_DATE(‘3/31/2016’, ‘MM/DD/YYYY’), ‘Q’)
AS quarter
FROM DUAL

Leave a Reply

Your email address will not be published. Required fields are marked *