Jump to: navigation, search

Mysql QUARTER

From w3cyberlearnings

Contents

MySQL QUARTER Function

This function returns the quarter of a given date. (1 years have 4 quarter, i.e 12/4).

Syntax QUARTER

  • expre: date or datetime expression.
QUARTER(expre);

Quarter

  • First Quarter: 1,2,3
  • Second Quarter:4,5,6
  • Third Quarter:7,8,9
  • Four Quarter:10,11,12

Example 1

mysql> SELECT QUARTER('2012-10-02');
+-----------------------+
| QUARTER('2012-10-02') |
+-----------------------+
|                     4 |
+-----------------------+
1 row in set (0.00 sec)


Example 2

mysql> SELECT QUARTER('2012-10-02 12:43:33');
+--------------------------------+
| QUARTER('2012-10-02 12:43:33') |
+--------------------------------+
|                              4 |
+--------------------------------+
1 row in set (0.00 sec)

Related Links



Navigation
Web
SQL
MISC
References