## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> QUARTER[QUARTER]:::quoted
QUARTER --> End((END))
```
## Purpose
The `QUARTER` SQL function collects the quarter from a date.
See also [[MONTH]] and [[YEAR]].
Parameters:
- Input (`datetime`): A `datetime`.
Returns: the quarter as an integer.
## Examples
The following example retrieves the quarter of March 15, 2026:
```sql
select quarter(to_date('20260315', 'YYYYMMDD'))
-------------------
1
```
The following example retrieves the quarter of October 1, 2026:
```sql
select quarter(to_date('20261001', 'YYYYMMDD'))
-------------------
4
```