QUARTER Function

Description

The QUARTER function returns the quarter in the range of 1 to 4 from specified argument. You can specify the DATE, TIMESTAMP, or DATETIME type; the value is returned in INTEGER type.

Syntax

QUARTER(date)

Example

SELECT QUARTER('2010-05-05');

   quarter('2010-05-05')

========================

                       2

 

SELECT QUARTER('2010-05-05 12:34:56');

  quarter('2010-05-05 12:34:56')

===============================

                              2

 

SELECT QUARTER('2010-05-05 12:34:56.7890');

  quarter('2010-05-05 12:34:56.7890')

==================================

                              2

 

SELECT QUARTER('12:34:56');

 

ERROR: Conversion error in date format.