dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL
Expertise: Intermediate
Oct 16, 2019

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


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 |
+---------------------+-----------+
M S Sridhar
 
Thanks for your registration, follow us on our social networks to keep up-to-date