Collections:
QUARTER() - Quarter of Year
How to extract the quarter of year from a given date using the QUARTER() function?
✍: FYIcenter.com
QUARTER(date) is a MySQL built-in function that
returns the quarter of year from a given date.
For example:
SELECT QUARTER('2023-02-03'), QUARTER(NOW()), NOW();
-- +-----------------------+----------------+---------------------+
-- | QUARTER('2023-02-03') | QUARTER(NOW()) | NOW() |
-- +-----------------------+----------------+---------------------+
-- | 1 | 4 | 2023-11-15 09:51:50 |
-- +-----------------------+----------------+---------------------+
Reference information of the QUARTER() function:
QUARTER(date): int Returns the quarter of the year for date, in the range 1 to 4. Arguments, return value and availability: date: Required. The date to extract the quarter of year from. int: Return value. The quarter of year. Available since MySQL 4.
Related MySQL functions:
⇐ PERIOD_DIFF() - Difference of Year-Month Periods
2023-11-17, 909🔥, 0💬
Popular Posts:
How To Create a Table Index in Oracle? If you have a table with a lots of rows, and you know that on...
How To Get the Definition of a User Defined Function Back in SQL Server Transact-SQL? If you want ge...
How To Set Up SQL*Plus Output Format in Oracle? If you want to practice SQL statements with SQL*Plus...
What Happens If the UPDATE Subquery Returns Multiple Rows in MySQL? If a subquery is used in a UPDAT...
What Is SQL*Plus in Oracle? SQL*Plus is an interactive and batch query tool that is installed with e...