Skip to content

QUARTER

  • date: The date parameter in the QUARTER(date) function for MySQL signifies the date from which the quarter of the year is to be extracted. It must be a valid date in the format “YYYY-MM-DD”, “YYYYMMDD”, “YYMMDD” or a year in string format like “YYYY”. The quarter is returned as an integer in the range from 1 to 4, with 1 representing the first quarter of the year (January, February, March) and 4 representing the last quarter of the year (October, November, December).
SELECT QUARTER('2021-07-18');
3

The QUARTER function in MySQL returns the quarter of the year for a date. The input date ‘2021-07-18’ falls in the third quarter of the year, therefore the output is 3.