This is an automated email from the ASF dual-hosted git repository.

zclll pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 34975181a12 feat: add quarter support to datetime functions (#2769)
34975181a12 is described below

commit 34975181a12585e655eeaf3306453cef02c2d973
Author: zclllyybb <[email protected]>
AuthorDate: Wed Aug 20 15:26:36 2025 +0800

    feat: add quarter support to datetime functions (#2769)
    
    ## Versions
    
    - [x] dev
    - [x] 3.0 and 3.1
    - [ ] 2.1
    - [ ] 2.0
    
    ## Languages
    
    - [x] Chinese
    - [x] English
    
    ## Docs Checklist
    
    - [ ] Checked by AI
    - [ ] Test Cases Built
---
 .../array-functions/array-range.md                 |  2 +-
 .../date-time-functions/date-ceil.md               | 14 +++-
 .../date-time-functions/date-floor.md              | 14 +++-
 .../date-time-functions/quarter-ceil.md            | 71 ++++++++++++++++++++
 .../date-time-functions/quarter-floor.md           | 71 ++++++++++++++++++++
 .../date-time-functions/quarters-diff.md           | 42 ++++++++++++
 .../date-time-functions/timestampdiff.md           | 14 +++-
 .../array-functions/array-range.md                 |  2 +-
 .../date-time-functions/date-ceil.md               | 14 +++-
 .../date-time-functions/date-floor.md              | 14 +++-
 .../date-time-functions/quarter-ceil.md            | 71 ++++++++++++++++++++
 .../date-time-functions/quarter-floor.md           | 70 ++++++++++++++++++++
 .../date-time-functions/quarters-diff.md           | 42 ++++++++++++
 .../date-time-functions/timestampdiff.md           | 20 ++++--
 .../array-functions/array-range.md                 |  6 +-
 .../date-time-functions/date-ceil.md               | 18 +++++-
 .../date-time-functions/date-floor.md              | 18 +++++-
 .../date-time-functions/quarter-ceil.md            | 75 ++++++++++++++++++++++
 .../date-time-functions/quarter-floor.md           | 74 +++++++++++++++++++++
 .../date-time-functions/quarters-diff.md           | 46 +++++++++++++
 .../date-time-functions/timestampdiff.md           | 19 +++++-
 .../array-functions/array-range.md                 |  6 +-
 .../date-time-functions/date-ceil.md               | 18 +++++-
 .../date-time-functions/date-floor.md              | 18 +++++-
 .../date-time-functions/quarter-ceil.md            | 75 ++++++++++++++++++++++
 .../date-time-functions/quarter-floor.md           | 75 ++++++++++++++++++++++
 .../date-time-functions/quarters-diff.md           | 46 +++++++++++++
 .../date-time-functions/timestampdiff.md           | 18 +++++-
 28 files changed, 954 insertions(+), 19 deletions(-)

diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md 
b/docs/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
index 49de41fe8b8..1ff95a184cc 100644
--- 
a/docs/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
@@ -34,7 +34,7 @@ ARRAY_RANGE(<start_datetime>, <end_datetime>, INTERVAL 
<interval_step> <unit>)
 | `<start_datetime>` | Start date, datetimev2 type |
 | `<end_datetime>` | End date, datetimev2 type |
 | `<interval_step>` | Interval value, default is 1 |
-| `<unit>` | Interval unit, supports year/month/week/day/hour/minute/second, 
default is day |
+| `<unit>` | Interval unit, supports 
year/quarter/month/week/day/hour/minute/second, default is day |
 
 ## Return Value
 
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
 
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
index 080884e2c3c..ccb7d116fa4 100644
--- 
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
@@ -19,7 +19,7 @@
 | -- | -- |
 | `datetime` | The argument is a valid date expression |
 | `period` | The argument specifies how many units make up each period, with 
the start time being 0001-01-01T00:00:00 |
-| `type` | The argument can be: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND|
+| `type` | The argument can be: YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, 
SECOND|
 
 ## Return Value
 
@@ -84,6 +84,18 @@ select date_ceil("2023-07-13 22:28:18",interval 5 month);
 +-------------------------------------------------------------+
 ```
 
+```sql
+select date_ceil("2023-07-13 22:28:18",interval 5 quarter);
+```
+
+```text
++-----------------------------------------------------+
+| date_ceil("2023-07-13 22:28:18",interval 5 quarter) |
++-----------------------------------------------------+
+| 2024-10-01 00:00:00                                 |
++-----------------------------------------------------+
+```
+
 ```sql
 select date_ceil("2023-07-13 22:28:18",interval 5 year);
 ```
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
 
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
index d959d8d5f27..661d5769ae2 100644
--- 
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
@@ -19,7 +19,7 @@
 | -- | -- |
 | `datetime` | The argument is a valid date expression |
 | `period` | The argument specifies how many units make up each period, with 
the start time being 0001-01-01T00:00:00 |
-| `type` | The argument can be: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND|
+| `type` | The argument can be: YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, 
SECOND|
 
 ## Return Value
 
@@ -99,6 +99,18 @@ select date_floor("2023-07-13 22:28:18",interval 5 month);
 +--------------------------------------------------------------+
 ```
 
+```sql
+select date_floor("2023-07-13 22:28:18",interval 5 quarter);
+```
+
+```text
++------------------------------------------------------+
+| date_floor("2023-07-13 22:28:18",interval 5 quarter) |
++------------------------------------------------------+
+| 2023-07-01 00:00:00                                  |
++------------------------------------------------------+
+```
+
 ```sql
 select date_floor("2023-07-13 22:28:18",interval 5 year);
 ```
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-ceil.md
 
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-ceil.md
new file mode 100644
index 00000000000..4d09659028f
--- /dev/null
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-ceil.md
@@ -0,0 +1,71 @@
+---
+{
+    "title": "QUARTER_CEIL",
+    "language": "en"
+}
+---
+
+## Description
+
+Rounds a datetime value up to the nearest specified quarter period boundary. 
If an origin time is specified, the period is calculated based on that time.
+
+## Syntax
+
+```sql
+QUARTER_CEIL(<datetime>)
+QUARTER_CEIL(<datetime>, <origin>)
+QUARTER_CEIL(<datetime>, <period>)
+QUARTER_CEIL(<datetime>, <period>, <origin>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| ---- | ---- |
+| `<datetime>` | The datetime value to round up, type is DATE or DATETIME |
+| `<period>` | Quarter period value, type is INT, representing the number of 
quarters contained in each period |
+| `<origin>` | The starting point of the period, type is DATE or DATETIME, 
default value is 0001-01-01 00:00:00 |
+
+Notes:
+- When period is not specified, it is equivalent to using 1 quarter as the 
period
+- When period is not a positive integer, the function result will be NULL
+- The result always rounds to the future time
+- The time part of the return value is always 00:00:00
+
+## Return Value
+
+When `<datetime>` is of DATE type, the return type is DATE.
+When `<datetime>` is of DATETIME type, the return type is DATETIME.
+Represents the rounded up datetime value. The time part of the result will be 
set to 00:00:00.
+
+## Examples
+
+Starting from '0001-01-01 00:00:00', with periods of 5 / 4 quarters each, 
return the next period start point closest to the input date.
+```sql
+SELECT QUARTER_CEIL("2023-07-13 22:28:18", 5), QUARTER_CEIL("2023-07-13 
22:28:18", 4);
+```
+
+```text
++----------------------------------------+----------------------------------------+
+| QUARTER_CEIL("2023-07-13 22:28:18", 5) | QUARTER_CEIL("2023-07-13 22:28:18", 
4) |
++----------------------------------------+----------------------------------------+
+| 2024-10-01 00:00:00.000000             | 2024-01-01 00:00:00.000000          
   |
++----------------------------------------+----------------------------------------+
+```
+
+Using '2022-01-01 00:00:00' as the period start point, with periods of 2 / 4 
quarters each, return the next period start point closest to the input date.
+```sql
+SELECT QUARTER_CEIL("2023-03-13 22:28:18", 2, "2022-01-01 00:00:00"), 
QUARTER_CEIL("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00");
+```
+
+```text
++---------------------------------------------------------------+---------------------------------------------------------------+
+| QUARTER_CEIL("2023-03-13 22:28:18", 2, "2022-01-01 00:00:00") | 
QUARTER_CEIL("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00") |
++---------------------------------------------------------------+---------------------------------------------------------------+
+| 2023-07-01 00:00:00                                           | 2024-01-01 
00:00:00                                           |
++---------------------------------------------------------------+---------------------------------------------------------------+
+```
+
+## Best Practices
+
+See also [date_ceil](./date-ceil)
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-floor.md
 
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-floor.md
new file mode 100644
index 00000000000..ec87ef601f4
--- /dev/null
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-floor.md
@@ -0,0 +1,71 @@
+---
+{
+    "title": "QUARTER_FLOOR",
+    "language": "en"
+}
+---
+
+## Description
+
+Rounds a datetime value down to the nearest specified quarter period boundary. 
If an origin time is specified, the period is calculated based on that time.
+
+## Syntax
+
+```sql
+QUARTER_FLOOR(<datetime>)
+QUARTER_FLOOR(<datetime>, <origin>)
+QUARTER_FLOOR(<datetime>, <period>)
+QUARTER_FLOOR(<datetime>, <period>, <origin>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| ---- | ---- |
+| `<datetime>` | The datetime value to round down, type is DATE or DATETIME |
+| `<period>` | Quarter period value, type is INT, representing the number of 
quarters contained in each period |
+| `<origin>` | The starting point of the period, type is DATE or DATETIME, 
default value is 0001-01-01 00:00:00 |
+
+Notes:
+- When period is not specified, it is equivalent to using 1 quarter as the 
period
+- When period is not a positive integer, the function result will be NULL
+- The result always rounds to the past time
+- The time part of the return value is always 00:00:00
+
+## Return Value
+
+When `<datetime>` is of DATE type, the return type is DATE.
+When `<datetime>` is of DATETIME type, the return type is DATETIME.
+The time part of the result will be set to 00:00:00.
+
+## Examples
+
+Starting from '0001-01-01 00:00:00', with periods of 5 / 4 quarters each, 
return the period start point closest to the input date.
+```sql
+SELECT QUARTER_FLOOR("2023-07-13 22:28:18", 5), QUARTER_FLOOR("2023-07-13 
22:28:18", 4);
+```
+
+```text
++-----------------------------------------+-----------------------------------------+
+| QUARTER_FLOOR("2023-07-13 22:28:18", 5) | QUARTER_FLOOR("2023-07-13 
22:28:18", 4) |
++-----------------------------------------+-----------------------------------------+
+| 2021-01-01 00:00:00                     | 2022-01-01 00:00:00                
     |
++-----------------------------------------+-----------------------------------------+
+```
+
+Using '2022-01-01 00:00:00' as the period start point, with periods of 2 / 4 
quarters each, return the period start point closest to the input date.
+```sql
+SELECT QUARTER_FLOOR("2023-03-13 22:28:18", 2, "2022-01-01 00:00:00"), 
QUARTER_FLOOR("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00");
+```
+
+```text
++----------------------------------------------------------------+----------------------------------------------------------------+
+| QUARTER_FLOOR("2023-03-13 22:28:18", 2, "2022-01-01 00:00:00") | 
QUARTER_FLOOR("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00") |
++----------------------------------------------------------------+----------------------------------------------------------------+
+| 2023-01-01 00:00:00                                            | 2022-01-01 
00:00:00                                            |
++----------------------------------------------------------------+----------------------------------------------------------------+
+```
+
+## Best Practices
+
+See also [date_floor](./date-floor)
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/quarters-diff.md
 
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/quarters-diff.md
new file mode 100644
index 00000000000..0254834a3ef
--- /dev/null
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/quarters-diff.md
@@ -0,0 +1,42 @@
+---
+{
+    "title": "QUARTERS_DIFF",
+    "language": "en"
+}
+---
+
+## Description
+
+The `QUARTERS_DIFF` function calculates the number of quarters between two 
dates. This function accepts two date parameters and returns the difference in 
quarters after subtracting the second date from the first date. The difference 
in quarters is equivalent to the difference in months divided by 3 (rounded 
towards zero).
+
+## Syntax
+
+```sql
+QUARTERS_DIFF(<enddate>, <startdate>)
+```
+
+## Parameters
+
+| Parameter     | Description                                                  
                         |
+|---------------|--------------------------------------------------------------------------------------|
+| `<enddate>`   | End date, represents the later date when calculating the 
difference. Supports `DATE` or `DATETIME` types |
+| `<startdate>` | Start date, represents the earlier date when calculating the 
difference. Supports `DATE` or `DATETIME` types |
+
+## Return Value
+
+Returns the number of quarters obtained by subtracting `<startdate>` from 
`<enddate>`
+- When either `<enddate>` or `<startdate>` is NULL, returns NULL
+
+## Examples
+
+```sql
+select QUARTERS_DIFF('2021-03-25', '2020-10-25'), QUARTERS_DIFF('2020-10-25 
10:00:00', '2022-12-25 11:00:00');
+```
+
+```text
++------------------------------------------+------------------------------------------------------------+
+| QUARTERS_DIFF('2021-03-25','2020-10-25') | QUARTERS_DIFF('2020-10-25 
10:00:00','2022-12-25 11:00:00') |
++------------------------------------------+------------------------------------------------------------+
+|                                        1 |                                   
                      -8 |
++------------------------------------------+------------------------------------------------------------+
+```
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
 
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
index a78157fa12c..8f6d809f2f8 100644
--- 
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
@@ -17,7 +17,7 @@ The `timestampdiff` function is used to calculate the 
difference between two  da
 
 | Parameter | Description                                                      
                                                            |
 | -- 
|------------------------------------------------------------------------------------------------------------------------------|
-| `unit` | Time unit, specifies the unit in which to return the difference, 
common values include SECOND, MINUTE, HOUR, DAY, MONTH, YEAR |
+| `unit` | Time unit, specifies the unit to return the difference in, supports 
SECOND, MINUTE, HOUR, DAY, MONTH, QUARTER, YEAR |
 | `datetime_expr1` | The first datetime, a valid target  date                  
                                                                   |
 | `datetime_expr2` | The second datetime, a valid target  date                 
                                                       |
 
@@ -41,6 +41,18 @@ SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');
 +--------------------------------------------------------------------+
 ```
 
+```sql
+SELECT TIMESTAMPDIFF(QUARTER,'2002-05-01','2001-01-01');
+```
+
+```text
++--------------------------------------------------+
+| TIMESTAMPDIFF(QUARTER,'2002-05-01','2001-01-01') |
++--------------------------------------------------+
+|                                               -5 |
++--------------------------------------------------+
+```
+
 ```sql
 SELECT TIMESTAMPDIFF(YEAR,'2002-05-01','2001-01-01');
 ```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
index 364c3d40c7c..03f8349431c 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
@@ -34,7 +34,7 @@ ARRAY_RANGE(<start_datetime>, <end_datetime>, INTERVAL 
<interval_step> <unit>)
 | `<start_datetime>` | 起始日期,为 datetimev2 类型 |
 | `<end_datetime>` | 结束日期,为 datetimev2 类型 |
 | `<interval_step>` | 间隔值,默认为 1 |
-| `<unit>` | 间隔单位,支持年/月/周/日/小时/分钟/秒,默认为日 |
+| `<unit>` | 
间隔单位,支持年(year)/季度(quarter)/月(month)/周(week)/日(day)/小时(hour)/分钟(minute)/秒(second),默认为日(day)
 |
 
 ## 返回值
 
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
index a2c02e00d2f..babb43f5970 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
@@ -19,7 +19,7 @@
 | -- | -- |
 | `datetime` | 参数是合法的日期表达式 |
 | `period` | 参数是指定每个周期有多少个单位组成,开始的时间起点为 0001-01-01T00:00:00 |
-| `type` | 参数可以是:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND |
+| `type` | 参数可以是:YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, SECOND |
 
 ## 返回值
 
@@ -84,6 +84,18 @@ select date_ceil("2023-07-13 22:28:18",interval 5 month);
 +-------------------------------------------------------------+
 ```
 
+```sql
+select date_ceil("2023-07-13 22:28:18",interval 5 quarter);
+```
+
+```text
++-----------------------------------------------------+
+| date_ceil("2023-07-13 22:28:18",interval 5 quarter) |
++-----------------------------------------------------+
+| 2024-10-01 00:00:00                                 |
++-----------------------------------------------------+
+```
+
 ```sql
 select date_ceil("2023-07-13 22:28:18",interval 5 year);
 ```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
index dd5b44272bf..679812aa4c2 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
@@ -19,7 +19,7 @@
 | -- | -- |
 | `datetime` | 参数是合法的日期表达式 |
 | `period` | 参数是指定每个周期有多少个单位组成,开始的时间起点为 0001-01-01T00:00:00 |
-| `type` | 参数可以是:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND |
+| `type` | 参数可以是:YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, SECOND |
 
 ## 返回值
 
@@ -99,6 +99,18 @@ select date_floor("2023-07-13 22:28:18",interval 5 month);
 +--------------------------------------------------------------+
 ```
 
+```sql
+select date_floor("2023-07-13 22:28:18",interval 5 quarter);
+```
+
+```text
++------------------------------------------------------+
+| date_floor("2023-07-13 22:28:18",interval 5 quarter) |
++------------------------------------------------------+
+| 2023-07-01 00:00:00                                  |
++------------------------------------------------------+
+```
+
 ```sql
 select date_floor("2023-07-13 22:28:18",interval 5 year);
 ```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-ceil.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-ceil.md
new file mode 100644
index 00000000000..40c157841d7
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-ceil.md
@@ -0,0 +1,71 @@
+---
+{
+    "title": "QUARTER_CEIL",
+    "language": "zh-CN"
+}
+---
+
+## 描述
+
+将日期时间值向上取整到最近的指定季度周期的下个周期起点。如果指定了起始时间(origin),则以该时间为基准计算周期。
+
+## 语法
+
+```sql
+QUARTER_CEIL(<datetime>)
+QUARTER_CEIL(<datetime>, <origin>)
+QUARTER_CEIL(<datetime>, <period>)
+QUARTER_CEIL(<datetime>, <period>, <origin>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ---- | ---- |
+| `<datetime>` | 需要向上取整的日期时间值,类型为 DATE 或 DATETIME |
+| `<period>` | 季度周期值,类型为 INT,表示每个周期包含的季度数 |
+| `<origin>` | 周期的起始时间点,类型为 DATE 或 DATETIME,默认值为 0001-01-01 00:00:00 |
+
+注意:
+- 不指定 period 时,等价于以 1 个季度为周期
+- 当 period 不为正整数时,函数结果将为 NULL
+- 结果总是向过去时间取整
+- 返回值的时间部分总是 00:00:00
+
+## 返回值
+
+当 `<datetime>` 为 DATE 类型时,返回类型为 DATE。
+当 `<datetime>` 为 DATETIME 类型时,返回类型为 DATETIME。
+表示向上取整后的日期时间值。结果的时间部分将被设置为 00:00:00。
+
+## 举例
+
+从 '0001-01-01 00:00:00' 开始,每 5 / 4 个季度为一个周期,返回距离输入日期最近的下一个周期起点。
+```sql
+SELECT QUARTER_CEIL("2023-07-13 22:28:18", 5), QUARTER_CEIL("2023-07-13 
22:28:18", 4);
+```
+
+```text
++----------------------------------------+----------------------------------------+
+| QUARTER_CEIL("2023-07-13 22:28:18", 5) | QUARTER_CEIL("2023-07-13 22:28:18", 
4) |
++----------------------------------------+----------------------------------------+
+| 2024-10-01 00:00:00.000000             | 2024-01-01 00:00:00.000000          
   |
++----------------------------------------+----------------------------------------+
+```
+
+以 '2022-01-01 00:00:00' 为周期起点,分别以 2 / 4 个季度为一个周期,返回距离输入日期最近的下一个周期起点。
+```sql
+SELECT QUARTER_CEIL("2023-03-13 22:28:18", 2, "2022-01-01 00:00:00"), 
QUARTER_CEIL("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00");
+```
+
+```text
++---------------------------------------------------------------+---------------------------------------------------------------+
+| QUARTER_CEIL("2023-03-13 22:28:18", 2, "2022-01-01 00:00:00") | 
QUARTER_CEIL("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00") |
++---------------------------------------------------------------+---------------------------------------------------------------+
+| 2023-07-01 00:00:00                                           | 2024-01-01 
00:00:00                                           |
++---------------------------------------------------------------+---------------------------------------------------------------+
+```
+
+## 最佳实践
+
+还可参阅 [date_ceil](./date-ceil)
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-floor.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-floor.md
new file mode 100644
index 00000000000..ccaece7a43d
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-floor.md
@@ -0,0 +1,70 @@
+---
+{
+    "title": "QUARTER_FLOOR",
+    "language": "zh-CN"
+}
+---
+
+## 描述
+
+将日期时间值向下取整到最近的指定季度周期起点。如果指定了起始时间(origin),则以该时间为基准计算周期。
+
+## 语法
+
+```sql
+QUARTER_FLOOR(<datetime>)
+QUARTER_FLOOR(<datetime>, <origin>)
+QUARTER_FLOOR(<datetime>, <period>)
+QUARTER_FLOOR(<datetime>, <period>, <origin>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ---- | ---- |
+| `<datetime>` | 需要向下取整的日期时间值,类型为 DATE 或 DATETIME |
+| `<period>` | 季度周期值,类型为 INT,表示每个周期包含的季度数 |
+| `<origin>` | 周期的起始时间点,类型为 DATE 或 DATETIME,默认值为 0001-01-01 00:00:00 |
+
+注意:
+- 不指定 period 时,等价于以 1 个季度为周期
+- 当 period 不为正整数时,函数结果将为 NULL
+- 结果总是向过去时间取整
+- 返回值的时间部分总是 00:00:00
+
+## 返回值
+
+当 `<datetime>` 为 DATE 类型时,返回类型为 DATE。
+当 `<datetime>` 为 DATETIME 类型时,返回类型为 DATETIME。
+结果的时间部分将被设置为 00:00:00。
+
+## 举例
+
+从 '0001-01-01 00:00:00' 开始,每 5 / 4 个季度为一个周期,返回距离输入日期最近的周期起点。
+```sql
+SELECT QUARTER_FLOOR("2023-07-13 22:28:18", 5), QUARTER_FLOOR("2023-07-13 
22:28:18", 4);
+```
+
+```text
++-----------------------------------------+-----------------------------------------+
+| QUARTER_FLOOR("2023-07-13 22:28:18", 5) | QUARTER_FLOOR("2023-07-13 
22:28:18", 4) |
++-----------------------------------------+-----------------------------------------+
+| 2023-07-01 00:00:00.000000              | 2023-01-01 00:00:00.000000         
     |
++-----------------------------------------+-----------------------------------------+
+```
+
+```sql
+SELECT QUARTER_FLOOR("2023-07-13 22:28:18", 2, "2022-01-01 00:00:00"), 
QUARTER_FLOOR("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00");
+```
+
+```text
++----------------------------------------------------------------+----------------------------------------------------------------+
+| QUARTER_FLOOR("2023-07-13 22:28:18", 2, "2022-01-01 00:00:00") | 
QUARTER_FLOOR("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00") |
++----------------------------------------------------------------+----------------------------------------------------------------+
+| 2023-07-01 00:00:00                                            | 2023-01-01 
00:00:00                                            |
++----------------------------------------------------------------+----------------------------------------------------------------+
+```
+
+## 最佳实践
+
+还可参阅 [date_floor](./date-floor)
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/quarters-diff.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/quarters-diff.md
new file mode 100644
index 00000000000..9c5abc79ea8
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/quarters-diff.md
@@ -0,0 +1,42 @@
+---
+{
+    "title": "QUARTERS_DIFF",
+    "language": "zh-CN"
+}
+---
+
+## 描述
+
+`QUARTERS_DIFF` 
函数用于计算两个日期之间相差的季度数。该函数接受两个日期参数,返回第一个日期减去第二个日期后的相差季度数。相差季度数等价于相差月份数除以 3(向 0 取整)。
+
+## 语法
+
+```sql
+QUARTERS_DIFF(<enddate>, <startdate>)
+```
+
+## 参数
+
+| 参数            | 说明                                                      |
+|---------------|---------------------------------------------------------|
+| `<enddate>`   | 结束日期,表示计算差值时的较晚日期。支持 `DATE` 或 `DATETIME` 类型 |
+| `<startdate>` | 开始日期,表示计算差值时的较早日期。支持 `DATE` 或 `DATETIME` 类型 |
+
+## 返回值
+
+返回 `<enddate>` 减去 `<startdate>` 所得季度数
+- 当 `<enddate>` 与 `<startdate>` 任意为 NULL 时,返回 NULL
+
+## 举例
+
+```sql
+select QUARTERS_DIFF('2021-03-25', '2020-10-25'), QUARTERS_DIFF('2020-10-25 
10:00:00', '2022-12-25 11:00:00');
+```
+
+```text
++------------------------------------------+------------------------------------------------------------+
+| QUARTERS_DIFF('2021-03-25','2020-10-25') | QUARTERS_DIFF('2020-10-25 
10:00:00','2022-12-25 11:00:00') |
++------------------------------------------+------------------------------------------------------------+
+|                                        1 |                                   
                      -8 |
++------------------------------------------+------------------------------------------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
index 25e1aa9529d..1747987fd04 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
@@ -7,7 +7,7 @@
 
 ## 描述
 
-`timestampdiff` 
函数用于计算两个日期之间的差值,返回两个日期之间的时间间隔。可以计算两者之间的差异,以指定的时间单位(如秒、分钟、小时、天、月、年等)返回结果。
+`timestampdiff` 
函数用于计算两个日期之间的差值,返回两个日期之间的时间间隔。可以计算两者之间的差异,以指定的时间单位(支持秒、分钟、小时、天、月、季度、年)返回结果。
 
 ## 语法
 
@@ -17,15 +17,15 @@
 
 | 参数 | 说明                                                        |
 | -- |-----------------------------------------------------------|
-| `unit` | 时间单位,指定要返回差异的单位,常见的值有 SECOND、MINUTE、HOUR、DAY、MONTH、YEAR 等 |
+| `unit` | 时间单位,指定要返回差异的单位,支持 SECOND、MINUTE、HOUR、DAY、MONTH、QUARTER、YEAR |
 |`datetime_expr1`| 第一个日期时间,合法的日期格式                                           |
 |`datetime_expr2`| 第二个日期时间,合法的日期格式                                           |
 
 ## 返回值
 
- 返回两个日期时间之间的差异,单位根据 unit 参数确定。
+返回 `datetime_expr2` 减去 `datetime_expr1` 的时间差,单位根据 unit 参数确定。
 
- 如果输入的参数不合法,则返回 `NULL`
+如果输入的参数为 NULL 则返回 NULL。
 
 ## 举例
 
@@ -41,6 +41,18 @@ SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');
 +--------------------------------------------------------------------+
 ```
 
+```sql
+SELECT TIMESTAMPDIFF(QUARTER,'2002-05-01','2001-01-01');
+```
+
+```text
++--------------------------------------------------+
+| TIMESTAMPDIFF(QUARTER,'2002-05-01','2001-01-01') |
++--------------------------------------------------+
+|                                               -5 |
++--------------------------------------------------+
+```
+
 ```sql
 SELECT TIMESTAMPDIFF(YEAR,'2002-05-01','2001-01-01');
 ```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
index 364c3d40c7c..2962c8703ea 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
@@ -34,7 +34,11 @@ ARRAY_RANGE(<start_datetime>, <end_datetime>, INTERVAL 
<interval_step> <unit>)
 | `<start_datetime>` | 起始日期,为 datetimev2 类型 |
 | `<end_datetime>` | 结束日期,为 datetimev2 类型 |
 | `<interval_step>` | 间隔值,默认为 1 |
-| `<unit>` | 间隔单位,支持年/月/周/日/小时/分钟/秒,默认为日 |
+| `<unit>` | 
间隔单位,支持年(year)/季度(quarter)/月(month)/周(week)/日(day)/小时(hour)/分钟(minute)/秒(second),默认为日(day)
 |
+
+:::tip 
+quarter 支持从 3.0.8 和 3.1.0 版本开始。
+:::
 
 ## 返回值
 
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
index a2c02e00d2f..68cfd0c5634 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
@@ -19,7 +19,11 @@
 | -- | -- |
 | `datetime` | 参数是合法的日期表达式 |
 | `period` | 参数是指定每个周期有多少个单位组成,开始的时间起点为 0001-01-01T00:00:00 |
-| `type` | 参数可以是:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND |
+| `type` | 参数可以是:YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, SECOND |
+
+:::tip 
+QUARTER 支持从 3.0.8 和 3.1.0 版本开始。
+:::
 
 ## 返回值
 
@@ -84,6 +88,18 @@ select date_ceil("2023-07-13 22:28:18",interval 5 month);
 +-------------------------------------------------------------+
 ```
 
+```sql
+select date_ceil("2023-07-13 22:28:18",interval 5 quarter);
+```
+
+```text
++-----------------------------------------------------+
+| date_ceil("2023-07-13 22:28:18",interval 5 quarter) |
++-----------------------------------------------------+
+| 2024-10-01 00:00:00                                 |
++-----------------------------------------------------+
+```
+
 ```sql
 select date_ceil("2023-07-13 22:28:18",interval 5 year);
 ```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
index dd5b44272bf..ae76307f2aa 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
@@ -19,7 +19,11 @@
 | -- | -- |
 | `datetime` | 参数是合法的日期表达式 |
 | `period` | 参数是指定每个周期有多少个单位组成,开始的时间起点为 0001-01-01T00:00:00 |
-| `type` | 参数可以是:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND |
+| `type` | 参数可以是:YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, SECOND |
+
+:::tip 
+QUARTER 支持从 3.0.8 和 3.1.0 版本开始。
+:::
 
 ## 返回值
 
@@ -99,6 +103,18 @@ select date_floor("2023-07-13 22:28:18",interval 5 month);
 +--------------------------------------------------------------+
 ```
 
+```sql
+select date_floor("2023-07-13 22:28:18",interval 5 quarter);
+```
+
+```text
++------------------------------------------------------+
+| date_floor("2023-07-13 22:28:18",interval 5 quarter) |
++------------------------------------------------------+
+| 2023-07-01 00:00:00                                  |
++------------------------------------------------------+
+```
+
 ```sql
 select date_floor("2023-07-13 22:28:18",interval 5 year);
 ```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-ceil.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-ceil.md
new file mode 100644
index 00000000000..0b68d89f8a7
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-ceil.md
@@ -0,0 +1,75 @@
+---
+{
+    "title": "QUARTER_CEIL",
+    "language": "zh-CN"
+}
+---
+
+## 描述
+
+将日期时间值向上取整到最近的指定季度周期的下个周期起点。如果指定了起始时间(origin),则以该时间为基准计算周期。
+
+:::tip 
+QUARTER_CEIL 支持从 3.0.8 和 3.1.0 版本开始。
+:::
+
+## 语法
+
+```sql
+QUARTER_CEIL(<datetime>)
+QUARTER_CEIL(<datetime>, <origin>)
+QUARTER_CEIL(<datetime>, <period>)
+QUARTER_CEIL(<datetime>, <period>, <origin>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ---- | ---- |
+| `<datetime>` | 需要向上取整的日期时间值,类型为 DATE 或 DATETIME |
+| `<period>` | 季度周期值,类型为 INT,表示每个周期包含的季度数 |
+| `<origin>` | 周期的起始时间点,类型为 DATE 或 DATETIME,默认值为 0001-01-01 00:00:00 |
+
+注意:
+- 不指定 period 时,等价于以 1 个季度为周期
+- 当 period 不为正整数时,函数结果将为 NULL
+- 结果总是向过去时间取整
+- 返回值的时间部分总是 00:00:00
+
+## 返回值
+
+当 `<datetime>` 为 DATE 类型时,返回类型为 DATE。
+当 `<datetime>` 为 DATETIME 类型时,返回类型为 DATETIME。
+表示向上取整后的日期时间值。结果的时间部分将被设置为 00:00:00。
+
+## 举例
+
+从 '0001-01-01 00:00:00' 开始,每 5 / 4 个季度为一个周期,返回距离输入日期最近的下一个周期起点。
+```sql
+SELECT QUARTER_CEIL("2023-07-13 22:28:18", 5), QUARTER_CEIL("2023-07-13 
22:28:18", 4);
+```
+
+```text
++----------------------------------------+----------------------------------------+
+| QUARTER_CEIL("2023-07-13 22:28:18", 5) | QUARTER_CEIL("2023-07-13 22:28:18", 
4) |
++----------------------------------------+----------------------------------------+
+| 2024-10-01 00:00:00.000000             | 2024-01-01 00:00:00.000000          
   |
++----------------------------------------+----------------------------------------+
+```
+
+以 '2022-01-01 00:00:00' 为周期起点,分别以 2 / 4 个季度为一个周期,返回距离输入日期最近的下一个周期起点。
+```sql
+SELECT QUARTER_CEIL("2023-03-13 22:28:18", 2, "2022-01-01 00:00:00"), 
QUARTER_CEIL("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00");
+```
+
+```text
++---------------------------------------------------------------+---------------------------------------------------------------+
+| QUARTER_CEIL("2023-03-13 22:28:18", 2, "2022-01-01 00:00:00") | 
QUARTER_CEIL("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00") |
++---------------------------------------------------------------+---------------------------------------------------------------+
+| 2023-07-01 00:00:00                                           | 2024-01-01 
00:00:00                                           |
++---------------------------------------------------------------+---------------------------------------------------------------+
+```
+
+## 最佳实践
+
+还可参阅 [date_ceil](./date-ceil)
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-floor.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-floor.md
new file mode 100644
index 00000000000..b9a60ccf06f
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-floor.md
@@ -0,0 +1,74 @@
+---
+{
+    "title": "QUARTER_FLOOR",
+    "language": "zh-CN"
+}
+---
+
+## 描述
+
+将日期时间值向下取整到最近的指定季度周期起点。如果指定了起始时间(origin),则以该时间为基准计算周期。
+
+:::tip 
+QUARTER_FLOOR 支持从 3.0.8 和 3.1.0 版本开始。
+:::
+
+## 语法
+
+```sql
+QUARTER_FLOOR(<datetime>)
+QUARTER_FLOOR(<datetime>, <origin>)
+QUARTER_FLOOR(<datetime>, <period>)
+QUARTER_FLOOR(<datetime>, <period>, <origin>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ---- | ---- |
+| `<datetime>` | 需要向下取整的日期时间值,类型为 DATE 或 DATETIME |
+| `<period>` | 季度周期值,类型为 INT,表示每个周期包含的季度数 |
+| `<origin>` | 周期的起始时间点,类型为 DATE 或 DATETIME,默认值为 0001-01-01 00:00:00 |
+
+注意:
+- 不指定 period 时,等价于以 1 个季度为周期
+- 当 period 不为正整数时,函数结果将为 NULL
+- 结果总是向过去时间取整
+- 返回值的时间部分总是 00:00:00
+
+## 返回值
+
+当 `<datetime>` 为 DATE 类型时,返回类型为 DATE。
+当 `<datetime>` 为 DATETIME 类型时,返回类型为 DATETIME。
+结果的时间部分将被设置为 00:00:00。
+
+## 举例
+
+从 '0001-01-01 00:00:00' 开始,每 5 / 4 个季度为一个周期,返回距离输入日期最近的周期起点。
+```sql
+SELECT QUARTER_FLOOR("2023-07-13 22:28:18", 5), QUARTER_FLOOR("2023-07-13 
22:28:18", 4);
+```
+
+```text
++-----------------------------------------+-----------------------------------------+
+| QUARTER_FLOOR("2023-07-13 22:28:18", 5) | QUARTER_FLOOR("2023-07-13 
22:28:18", 4) |
++-----------------------------------------+-----------------------------------------+
+| 2023-07-01 00:00:00.000000              | 2023-01-01 00:00:00.000000         
     |
++-----------------------------------------+-----------------------------------------+
+```
+
+```sql
+SELECT QUARTER_FLOOR("2023-07-13 22:28:18", 2, "2022-01-01 00:00:00"), 
QUARTER_FLOOR("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00");
+```
+
+```text
++----------------------------------------------------------------+----------------------------------------------------------------+
+| QUARTER_FLOOR("2023-07-13 22:28:18", 2, "2022-01-01 00:00:00") | 
QUARTER_FLOOR("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00") |
++----------------------------------------------------------------+----------------------------------------------------------------+
+| 2023-07-01 00:00:00                                            | 2023-01-01 
00:00:00                                            |
++----------------------------------------------------------------+----------------------------------------------------------------+
+```
+
+## 最佳实践
+
+还可参阅 [date_floor](./date-floor)
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarters-diff.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarters-diff.md
new file mode 100644
index 00000000000..7be89145628
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarters-diff.md
@@ -0,0 +1,46 @@
+---
+{
+    "title": "QUARTERS_DIFF",
+    "language": "zh-CN"
+}
+---
+
+## 描述
+
+`QUARTERS_DIFF` 
函数用于计算两个日期之间相差的季度数。该函数接受两个日期参数,返回第一个日期减去第二个日期后的相差季度数。相差季度数等价于相差月份数除以 3(向 0 取整)。
+
+:::tip 
+QUARTERS_DIFF 支持从 3.0.8 和 3.1.0 版本开始。
+:::
+
+## 语法
+
+```sql
+QUARTERS_DIFF(<enddate>, <startdate>)
+```
+
+## 参数
+
+| 参数            | 说明                                                      |
+|---------------|---------------------------------------------------------|
+| `<enddate>`   | 结束日期,表示计算差值时的较晚日期。支持 `DATE` 或 `DATETIME` 类型 |
+| `<startdate>` | 开始日期,表示计算差值时的较早日期。支持 `DATE` 或 `DATETIME` 类型 |
+
+## 返回值
+
+返回 `<enddate>` 减去 `<startdate>` 所得季度数
+- 当 `<enddate>` 与 `<startdate>` 任意为 NULL 时,返回 NULL
+
+## 举例
+
+```sql
+select QUARTERS_DIFF('2021-03-25', '2020-10-25'), QUARTERS_DIFF('2020-10-25 
10:00:00', '2022-12-25 11:00:00');
+```
+
+```text
++------------------------------------------+------------------------------------------------------------+
+| QUARTERS_DIFF('2021-03-25','2020-10-25') | QUARTERS_DIFF('2020-10-25 
10:00:00','2022-12-25 11:00:00') |
++------------------------------------------+------------------------------------------------------------+
+|                                        1 |                                   
                      -8 |
++------------------------------------------+------------------------------------------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
index f6ebe1797f4..12c81bc28ab 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
@@ -17,7 +17,12 @@
 
 | 参数 | 说明                                                        |
 | -- |-----------------------------------------------------------|
-| `unit` | 时间单位,指定要返回差异的单位,常见的值有 SECOND、MINUTE、HOUR、DAY、MONTH、YEAR 等 |
+| `unit` | 时间单位,指定要返回差异的单位,支持 SECOND、MINUTE、HOUR、DAY、MONTH、QUARTER、YEAR |
+
+:::tip 
+QUARTER 支持从 3.0.8 和 3.1.0 版本开始。
+:::
+
 |`datetime_expr1`| 第一个日期时间,合法的日期格式                                           |
 |`datetime_expr2`| 第二个日期时间,合法的日期格式                                           |
 
@@ -41,6 +46,18 @@ SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');
 +--------------------------------------------------------------------+
 ```
 
+```sql
+SELECT TIMESTAMPDIFF(QUARTER,'2002-05-01','2001-01-01');
+```
+
+```text
++--------------------------------------------------+
+| TIMESTAMPDIFF(QUARTER,'2002-05-01','2001-01-01') |
++--------------------------------------------------+
+|                                               -5 |
++--------------------------------------------------+
+```
+
 ```sql
 SELECT TIMESTAMPDIFF(YEAR,'2002-05-01','2001-01-01');
 ```
diff --git 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
index 49de41fe8b8..17be783de9d 100644
--- 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
+++ 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/array-functions/array-range.md
@@ -34,7 +34,11 @@ ARRAY_RANGE(<start_datetime>, <end_datetime>, INTERVAL 
<interval_step> <unit>)
 | `<start_datetime>` | Start date, datetimev2 type |
 | `<end_datetime>` | End date, datetimev2 type |
 | `<interval_step>` | Interval value, default is 1 |
-| `<unit>` | Interval unit, supports year/month/week/day/hour/minute/second, 
default is day |
+| `<unit>` | Interval unit, supports 
year/quarter/month/week/day/hour/minute/second, default is day |
+
+:::tip 
+quarter is supported since version 3.0.8 and 3.1.0.
+:::
 
 ## Return Value
 
diff --git 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
index 080884e2c3c..9c06baca215 100644
--- 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
+++ 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md
@@ -19,7 +19,11 @@
 | -- | -- |
 | `datetime` | The argument is a valid date expression |
 | `period` | The argument specifies how many units make up each period, with 
the start time being 0001-01-01T00:00:00 |
-| `type` | The argument can be: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND|
+| `type` | The argument can be: YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, 
SECOND|
+
+:::tip 
+QUARTER is supported since version 3.0.8 and 3.1.0.
+:::
 
 ## Return Value
 
@@ -84,6 +88,18 @@ select date_ceil("2023-07-13 22:28:18",interval 5 month);
 +-------------------------------------------------------------+
 ```
 
+```sql
+select date_ceil("2023-07-13 22:28:18",interval 5 quarter);
+```
+
+```text
++-----------------------------------------------------+
+| date_ceil("2023-07-13 22:28:18",interval 5 quarter) |
++-----------------------------------------------------+
+| 2024-10-01 00:00:00                                 |
++-----------------------------------------------------+
+```
+
 ```sql
 select date_ceil("2023-07-13 22:28:18",interval 5 year);
 ```
diff --git 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
index d959d8d5f27..0979a21fadc 100644
--- 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
+++ 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-floor.md
@@ -19,7 +19,11 @@
 | -- | -- |
 | `datetime` | The argument is a valid date expression |
 | `period` | The argument specifies how many units make up each period, with 
the start time being 0001-01-01T00:00:00 |
-| `type` | The argument can be: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND|
+| `type` | The argument can be: YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, 
SECOND|
+
+:::tip 
+QUARTER is supported since version 3.0.8 and 3.1.0.
+:::
 
 ## Return Value
 
@@ -99,6 +103,18 @@ select date_floor("2023-07-13 22:28:18",interval 5 month);
 +--------------------------------------------------------------+
 ```
 
+```sql
+select date_floor("2023-07-13 22:28:18",interval 5 quarter);
+```
+
+```text
++------------------------------------------------------+
+| date_floor("2023-07-13 22:28:18",interval 5 quarter) |
++------------------------------------------------------+
+| 2023-07-01 00:00:00                                  |
++------------------------------------------------------+
+```
+
 ```sql
 select date_floor("2023-07-13 22:28:18",interval 5 year);
 ```
diff --git 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-ceil.md
 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-ceil.md
new file mode 100644
index 00000000000..7eedacf3fd2
--- /dev/null
+++ 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-ceil.md
@@ -0,0 +1,75 @@
+---
+{
+    "title": "QUARTER_CEIL",
+    "language": "en"
+}
+---
+
+## Description
+
+Rounds a datetime value up to the nearest specified quarter period boundary. 
If an origin time is specified, the period is calculated based on that time.
+
+:::tip 
+QUARTER_CEIL is supported since version 3.0.8 and 3.1.0.
+:::
+
+## Syntax
+
+```sql
+QUARTER_CEIL(<datetime>)
+QUARTER_CEIL(<datetime>, <origin>)
+QUARTER_CEIL(<datetime>, <period>)
+QUARTER_CEIL(<datetime>, <period>, <origin>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| ---- | ---- |
+| `<datetime>` | The datetime value to round up, type is DATE or DATETIME |
+| `<period>` | Quarter period value, type is INT, representing the number of 
quarters contained in each period |
+| `<origin>` | The starting point of the period, type is DATE or DATETIME, 
default value is 0001-01-01 00:00:00 |
+
+Notes:
+- When period is not specified, it is equivalent to using 1 quarter as the 
period
+- When period is not a positive integer, the function result will be NULL
+- The result always rounds to the future time
+- The time part of the return value is always 00:00:00
+
+## Return Value
+
+When `<datetime>` is of DATE type, the return type is DATE.
+When `<datetime>` is of DATETIME type, the return type is DATETIME.
+Represents the rounded up datetime value. The time part of the result will be 
set to 00:00:00.
+
+## Examples
+
+Starting from '0001-01-01 00:00:00', with periods of 5 / 4 quarters each, 
return the next period start point closest to the input date.
+```sql
+SELECT QUARTER_CEIL("2023-07-13 22:28:18", 5), QUARTER_CEIL("2023-07-13 
22:28:18", 4);
+```
+
+```text
++----------------------------------------+----------------------------------------+
+| QUARTER_CEIL("2023-07-13 22:28:18", 5) | QUARTER_CEIL("2023-07-13 22:28:18", 
4) |
++----------------------------------------+----------------------------------------+
+| 2024-10-01 00:00:00.000000             | 2024-01-01 00:00:00.000000          
   |
++----------------------------------------+----------------------------------------+
+```
+
+Using '2022-01-01 00:00:00' as the period start point, with periods of 2 / 4 
quarters each, return the next period start point closest to the input date.
+```sql
+SELECT QUARTER_CEIL("2023-03-13 22:28:18", 2, "2022-01-01 00:00:00"), 
QUARTER_CEIL("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00");
+```
+
+```text
++---------------------------------------------------------------+---------------------------------------------------------------+
+| QUARTER_CEIL("2023-03-13 22:28:18", 2, "2022-01-01 00:00:00") | 
QUARTER_CEIL("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00") |
++---------------------------------------------------------------+---------------------------------------------------------------+
+| 2023-07-01 00:00:00                                           | 2024-01-01 
00:00:00                                           |
++---------------------------------------------------------------+---------------------------------------------------------------+
+```
+
+## Best Practices
+
+See also [date_ceil](./date-ceil)
diff --git 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-floor.md
 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-floor.md
new file mode 100644
index 00000000000..def80262284
--- /dev/null
+++ 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarter-floor.md
@@ -0,0 +1,75 @@
+---
+{
+    "title": "QUARTER_FLOOR",
+    "language": "en"
+}
+---
+
+## Description
+
+Rounds a datetime value down to the nearest specified quarter period boundary. 
If an origin time is specified, the period is calculated based on that time.
+
+:::tip 
+QUARTER_FLOOR is supported since version 3.0.8 and 3.1.0.
+:::
+
+## Syntax
+
+```sql
+QUARTER_FLOOR(<datetime>)
+QUARTER_FLOOR(<datetime>, <origin>)
+QUARTER_FLOOR(<datetime>, <period>)
+QUARTER_FLOOR(<datetime>, <period>, <origin>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| ---- | ---- |
+| `<datetime>` | The datetime value to round down, type is DATE or DATETIME |
+| `<period>` | Quarter period value, type is INT, representing the number of 
quarters contained in each period |
+| `<origin>` | The starting point of the period, type is DATE or DATETIME, 
default value is 0001-01-01 00:00:00 |
+
+Notes:
+- When period is not specified, it is equivalent to using 1 quarter as the 
period
+- When period is not a positive integer, the function result will be NULL
+- The result always rounds to the past time
+- The time part of the return value is always 00:00:00
+
+## Return Value
+
+When `<datetime>` is of DATE type, the return type is DATE.
+When `<datetime>` is of DATETIME type, the return type is DATETIME.
+The time part of the result will be set to 00:00:00.
+
+## Examples
+
+Starting from '0001-01-01 00:00:00', with periods of 5 / 4 quarters each, 
return the period start point closest to the input date.
+```sql
+SELECT QUARTER_FLOOR("2023-07-13 22:28:18", 5), QUARTER_FLOOR("2023-07-13 
22:28:18", 4);
+```
+
+```text
++-----------------------------------------+-----------------------------------------+
+| QUARTER_FLOOR("2023-07-13 22:28:18", 5) | QUARTER_FLOOR("2023-07-13 
22:28:18", 4) |
++-----------------------------------------+-----------------------------------------+
+| 2021-01-01 00:00:00                     | 2022-01-01 00:00:00                
     |
++-----------------------------------------+-----------------------------------------+
+```
+
+Using '2022-01-01 00:00:00' as the period start point, with periods of 2 / 4 
quarters each, return the period start point closest to the input date.
+```sql
+SELECT QUARTER_FLOOR("2023-03-13 22:28:18", 2, "2022-01-01 00:00:00"), 
QUARTER_FLOOR("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00");
+```
+
+```text
++----------------------------------------------------------------+----------------------------------------------------------------+
+| QUARTER_FLOOR("2023-03-13 22:28:18", 2, "2022-01-01 00:00:00") | 
QUARTER_FLOOR("2023-07-13 22:28:18", 4, "2022-01-01 00:00:00") |
++----------------------------------------------------------------+----------------------------------------------------------------+
+| 2023-01-01 00:00:00                                            | 2022-01-01 
00:00:00                                            |
++----------------------------------------------------------------+----------------------------------------------------------------+
+```
+
+## Best Practices
+
+See also [date_floor](./date-floor)
diff --git 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarters-diff.md
 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarters-diff.md
new file mode 100644
index 00000000000..dd3d77a9d06
--- /dev/null
+++ 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/quarters-diff.md
@@ -0,0 +1,46 @@
+---
+{
+    "title": "QUARTERS_DIFF",
+    "language": "en"
+}
+---
+
+## Description
+
+The `QUARTERS_DIFF` function calculates the number of quarters between two 
dates. This function accepts two date parameters and returns the difference in 
quarters after subtracting the second date from the first date. The difference 
in quarters is equivalent to the difference in months divided by 3 (rounded 
towards zero).
+
+:::tip 
+QUARTERS_DIFF is supported since version 3.0.8 and 3.1.0.
+:::
+
+## Syntax
+
+```sql
+QUARTERS_DIFF(<enddate>, <startdate>)
+```
+
+## Parameters
+
+| Parameter     | Description                                                  
                         |
+|---------------|--------------------------------------------------------------------------------------|
+| `<enddate>`   | End date, represents the later date when calculating the 
difference. Supports `DATE` or `DATETIME` types |
+| `<startdate>` | Start date, represents the earlier date when calculating the 
difference. Supports `DATE` or `DATETIME` types |
+
+## Return Value
+
+Returns the number of quarters obtained by subtracting `<startdate>` from 
`<enddate>`
+- When either `<enddate>` or `<startdate>` is NULL, returns NULL
+
+## Examples
+
+```sql
+select QUARTERS_DIFF('2021-03-25', '2020-10-25'), QUARTERS_DIFF('2020-10-25 
10:00:00', '2022-12-25 11:00:00');
+```
+
+```text
++------------------------------------------+------------------------------------------------------------+
+| QUARTERS_DIFF('2021-03-25','2020-10-25') | QUARTERS_DIFF('2020-10-25 
10:00:00','2022-12-25 11:00:00') |
++------------------------------------------+------------------------------------------------------------+
+|                                        1 |                                   
                      -8 |
++------------------------------------------+------------------------------------------------------------+
+```
diff --git 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
index a78157fa12c..536b7455d7c 100644
--- 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
+++ 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/timestampdiff.md
@@ -17,7 +17,11 @@ The `timestampdiff` function is used to calculate the 
difference between two  da
 
 | Parameter | Description                                                      
                                                            |
 | -- 
|------------------------------------------------------------------------------------------------------------------------------|
-| `unit` | Time unit, specifies the unit in which to return the difference, 
common values include SECOND, MINUTE, HOUR, DAY, MONTH, YEAR |
+| `unit` | Time unit, specifies the unit to return the difference in, supports 
SECOND, MINUTE, HOUR, DAY, MONTH, QUARTER, YEAR |
+
+:::tip 
+QUARTER is supported since version 3.0.8 and 3.1.0.
+:::
 | `datetime_expr1` | The first datetime, a valid target  date                  
                                                                   |
 | `datetime_expr2` | The second datetime, a valid target  date                 
                                                       |
 
@@ -41,6 +45,18 @@ SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');
 +--------------------------------------------------------------------+
 ```
 
+```sql
+SELECT TIMESTAMPDIFF(QUARTER,'2002-05-01','2001-01-01');
+```
+
+```text
++--------------------------------------------------+
+| TIMESTAMPDIFF(QUARTER,'2002-05-01','2001-01-01') |
++--------------------------------------------------+
+|                                               -5 |
++--------------------------------------------------+
+```
+
 ```sql
 SELECT TIMESTAMPDIFF(YEAR,'2002-05-01','2001-01-01');
 ```


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to