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


advertisement
 

Tip: Finding the Current Quarter in MySQL

Learn how to use MySQL to find the current financial quarter.


advertisement

WEBINAR:

On-Demand

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


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 |
+---------------------+-----------+

 

Visit the DevX Tip Bank

 





   
Sridhar M S. is a Java developer from Bangalore, India. He holds a master's degree in Computer Science.
Thanks for your registration, follow us on our social networks to keep up-to-date