What does Quarter() function in SQL does?

QUARTER() function is used to return the quarter of the year for a given date value. It returns a number from 1 to 4.

Syntax :

QUARTER(date)

Parameter : The function accepts only one parameter

  • date : The date or DateTime from which we want to extract the quarter.

Returns : It returns 1 if the given date is in range January-March. 2 for April-June.3 for July-September and if the date is in the range from October-December it returns 4.

Example: Finding the Current QUARTER Using QUARTER() Function.

SELECT QUARTER(NOW()) AS CURRENT_QUARTER;

Output :

CURRENT_QUARTER

4