Comments - QUARTER

1 week, 2 days ago Alex Hanshaw

This function is calendar quarters only. Is there an ability to determine the financial quarter which is usually offset by 1 quarter with the 4th quarter being Jan-Mar in the following year?

 
1 week, 2 days ago Ian Gilfillan

You can do this with the ADDDATE function to offset by (in your case) three months. For example:

SELECT QUARTER(ADDDATE('2008-01-01', INTERVAL -3 MONTH));
+---------------------------------------------------+
| QUARTER(ADDDATE('2008-01-01', INTERVAL -3 MONTH)) |
+---------------------------------------------------+
|                                                 4 |
+---------------------------------------------------+
 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.