We can do this by providing the unit value "quarter" to the EXARCT() function. Example is as follows -
mysql> Select EXTRACT(Quarter from '2017-07-29'); +------------------------------------+ | EXTRACT(Quarter from '2017-07-29') | +------------------------------------+ | 3 | +------------------------------------+ 1 row in set (0.00 sec)
The above query will give the quarter value for a particular given date.
mysql> Select EXTRACT(Quarter from now()); +-----------------------------+ | EXTRACT(Quarter from now()) | +-----------------------------+ | 4 | +-----------------------------+ 1 row in set (0.00 sec)
The above query will give the quarter value for the current date.
The above is the detailed content of In MySQL, how do we find which quarter is the current date or a specific given date?. For more information, please follow other related articles on the PHP Chinese website!