QUARTER()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the quarter number for a date.
USAGE
QUARTER(date)
Argument Name | Description |
---|---|
| The |
DETAILS
QUARTER()
is a date-time function that returns the quarter number for the given date or timestamp.
The return value is in the range 1
to 4
for a valid argument.
The accepted date formats are YYYYMMDD
and YYYY-MM-DD
, with a wide variety of delineating characters also accepted in addition to dashes.
A NULL
is returned if the argument is NULL
or otherwise not a valid date.
EXAMPLES
SELECT QUARTER('2020-02-29'),
QUARTER('2020-06-30'),
QUARTER('2019-12-30');
+-----------------------+-----------------------+-----------------------+
| QUARTER('2020-02-29') | QUARTER('2020-06-30') | QUARTER('2019-12-30') |
+-----------------------+-----------------------+-----------------------+
| 1 | 2 | 4 |
+-----------------------+-----------------------+-----------------------+