devxlogo

Finding the Current Quarter in MySQL

Finding the Current Quarter in MySQL

With MySQL, we can find out the quarter by providing a date. In the example below, we will look at the current quarter with input as current date.

Query:

SELECT NOW() as 'TODAY' , QUARTER(NOW()) AS  'QUARTER #';

Sample Output:

+---------------------+-----------+| TODAY               | QUARTER # |+---------------------+-----------+| 2019-09-24 18:29:46 |         3 |+---------------------+-----------+

devx-admin

Share the Post: