This is an automated email from the ASF dual-hosted git repository. jiafengzheng 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 5b3ec602538 Optimized date function doc order and add partial function doc (#111) 5b3ec602538 is described below commit 5b3ec60253811ec8084ed1cbe72c2de8ddd7798e Author: zy-kkk <zhong...@qq.com> AuthorDate: Fri Sep 23 10:16:42 2022 +0800 Optimized date function doc order and add partial function doc (#111) --- .../{utc_timestamp.md => days_add.md} | 30 +++++----- .../{utc_timestamp.md => days_diff.md} | 30 +++++----- .../{utc_timestamp.md => days_sub.md} | 30 +++++----- .../{utc_timestamp.md => extract.md} | 39 +++++++------ .../{utc_timestamp.md => hours_add.md} | 30 +++++----- .../{utc_timestamp.md => hours_diff.md} | 30 +++++----- .../{utc_timestamp.md => hours_sub.md} | 30 +++++----- .../{utc_timestamp.md => localtime.md} | 42 +++++++------ .../{utc_timestamp.md => minutes_add.md} | 30 +++++----- .../{utc_timestamp.md => minutes_diff.md} | 30 +++++----- .../{utc_timestamp.md => minutes_sub.md} | 30 +++++----- .../{utc_timestamp.md => months_add.md} | 30 +++++----- .../{utc_timestamp.md => months_diff.md} | 30 +++++----- .../{utc_timestamp.md => months_sub.md} | 30 +++++----- .../{utc_timestamp.md => quarter.md} | 34 +++++------ .../{utc_timestamp.md => seconds_add.md} | 30 +++++----- .../{utc_timestamp.md => seconds_diff.md} | 30 +++++----- .../{utc_timestamp.md => seconds_sub.md} | 30 +++++----- .../date-time-functions/utc_timestamp.md | 1 + .../{utc_timestamp.md => weeks_add.md} | 30 +++++----- .../{utc_timestamp.md => weeks_diff.md} | 30 +++++----- .../{utc_timestamp.md => weeks_sub.md} | 30 +++++----- .../{utc_timestamp.md => year_floor.md} | 34 +++++------ .../{utc_timestamp.md => years_add.md} | 30 +++++----- .../{utc_timestamp.md => years_diff.md} | 30 +++++----- .../{utc_timestamp.md => years_sub.md} | 30 +++++----- .../sql-functions/date-time-functions/days_add.md | 32 +++++----- .../sql-functions/date-time-functions/days_diff.md | 32 +++++----- .../sql-functions/date-time-functions/days_sub.md | 32 +++++----- .../sql-functions/date-time-functions/extract.md | 53 +++++++++++++++++ .../sql-functions/date-time-functions/hours_add.md | 32 +++++----- .../date-time-functions/hours_diff.md | 32 +++++----- .../sql-functions/date-time-functions/hours_sub.md | 32 +++++----- .../sql-functions/date-time-functions/localtime.md | 44 ++++++++------ .../date-time-functions/minutes_add.md | 32 +++++----- .../date-time-functions/minutes_diff.md | 32 +++++----- .../date-time-functions/minutes_sub.md | 32 +++++----- .../date-time-functions/months_add.md | 32 +++++----- .../date-time-functions/months_diff.md | 32 +++++----- .../date-time-functions/months_sub.md | 32 +++++----- .../sql-functions/date-time-functions/quarter.md | 36 ++++++------ .../date-time-functions/seconds_add.md | 32 +++++----- .../date-time-functions/seconds_diff.md | 32 +++++----- .../date-time-functions/seconds_sub.md | 32 +++++----- .../sql-functions/date-time-functions/weeks_add.md | 32 +++++----- .../date-time-functions/weeks_diff.md | 32 +++++----- .../sql-functions/date-time-functions/weeks_sub.md | 32 +++++----- .../date-time-functions/year_floor.md | 36 ++++++------ .../sql-functions/date-time-functions/years_add.md | 32 +++++----- .../date-time-functions/years_diff.md | 32 +++++----- .../sql-functions/date-time-functions/years_sub.md | 32 +++++----- sidebars.json | 68 +++++++++++++++------- 52 files changed, 923 insertions(+), 766 deletions(-) diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/days_add.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/days_add.md index 24ad8a45813..8e244e62920 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/days_add.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "days_add", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## days_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME DAYS_ADD(DATETIME date, INT days)` +From date time or date plus specified days -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is consistent with that of the parameter date. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select days_add(to_date("2020-02-02 02:02:02"), 1); ++---------------------------------------------+ +| days_add(to_date('2020-02-02 02:02:02'), 1) | ++---------------------------------------------+ +| 2020-02-03 | ++---------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + DAYS_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/days_diff.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/days_diff.md index 24ad8a45813..183fe927b18 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/days_diff.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "days_diff", "language": "en" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## days_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT days_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The difference between the start time and the end time is a few days ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select days_diff('2020-12-25 22:00:00','2020-12-24 22:00:00'); ++---------------------------------------------------------+ +| days_diff('2020-12-25 22:00:00', '2020-12-24 22:00:00') | ++---------------------------------------------------------+ +| 1 | ++---------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + days_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/days_sub.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/days_sub.md index 24ad8a45813..435baa43db7 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/days_sub.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "days_sub", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## days_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME DAYS_SUB(DATETIME date, INT days)` +Subtract a specified number of days from a datetime or date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is consistent with that of the parameter date. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select days_sub("2020-02-02 02:02:02", 1); ++------------------------------------+ +| days_sub('2020-02-02 02:02:02', 1) | ++------------------------------------+ +| 2020-02-01 02:02:02 | ++------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + DAYS_SUB diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/extract.md similarity index 50% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/extract.md index 24ad8a45813..5651e4a132e 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/extract.md @@ -1,11 +1,11 @@ --- { - "title": "utc_timestamp", + "title": "extract", "language": "en" } --- -<!-- +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information @@ -24,25 +24,30 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## extract +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT extract(unit FROM DATETIME)` +Extract DATETIME The value of a specified unit. The unit can be year, day, hour, minute, or second -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context - -### example +### Example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select extract(year from '2022-09-22 17:01:30') as year, + -> extract(month from '2022-09-22 17:01:30') as month, + -> extract(day from '2022-09-22 17:01:30') as day, + -> extract(hour from '2022-09-22 17:01:30') as hour, + -> extract(minute from '2022-09-22 17:01:30') as minute, + -> extract(second from '2022-09-22 17:01:30') as second; ++------+-------+------+------+--------+--------+ +| year | month | day | hour | minute | second | ++------+-------+------+------+--------+--------+ +| 2022 | 9 | 22 | 17 | 1 | 30 | ++------+-------+------+------+--------+--------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + extract diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/hours_add.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/hours_add.md index 24ad8a45813..db1517d1541 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/hours_add.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "hours_add", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## hours_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME HOURS_ADD(DATETIME date, INT hours)` +Add specified hours from date time or date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is DATETIME. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select hours_add("2020-02-02 02:02:02", 1); ++-------------------------------------+ +| hours_add('2020-02-02 02:02:02', 1) | ++-------------------------------------+ +| 2020-02-02 03:02:02 | ++-------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + HOURS_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/hours_diff.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/hours_diff.md index 24ad8a45813..faaafa9a6c3 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/hours_diff.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "hours_diff", "language": "en" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## hours_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT hours_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The difference between the start time and the end time is a few hours ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select hours_diff('2020-12-25 22:00:00','2020-12-25 21:00:00'); ++----------------------------------------------------------+ +| hours_diff('2020-12-25 22:00:00', '2020-12-25 21:00:00') | ++----------------------------------------------------------+ +| 1 | ++----------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + hours_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/hours_sub.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/hours_sub.md index 24ad8a45813..b710972eb86 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/hours_sub.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "hours_sub", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## hours_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME HOURS_SUB(DATETIME date, INT hours)` +Subtracts a specified number of hours from a datetime or date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is DATETIME. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select hours_sub("2020-02-02 02:02:02", 1); ++-------------------------------------+ +| hours_sub('2020-02-02 02:02:02', 1) | ++-------------------------------------+ +| 2020-02-02 01:02:02 | ++-------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + HOURS_SUB diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/localtime.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/localtime.md index 24ad8a45813..e4d7f222fc4 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/localtime.md @@ -1,11 +1,11 @@ --- { - "title": "utc_timestamp", + "title": "localtime,localtimestamp", "language": "en" } --- -<!-- +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information @@ -24,25 +24,33 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## localtime,localtimestamp +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME localtime()` +`DATETIME localtimestamp()` +Get the current time and return it in Datetime type. -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context - -### example +### Example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select localtime(); ++---------------------+ +| localtime() | ++---------------------+ +| 2022-09-22 17:30:23 | ++---------------------+ + +mysql> select localtimestamp(); ++---------------------+ +| localtimestamp() | ++---------------------+ +| 2022-09-22 17:30:29 | ++---------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + localtime,localtimestamp diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/minutes_add.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/minutes_add.md index 24ad8a45813..0e4b2cc3d9e 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/minutes_add.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "minutes_add", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## minutes_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME MINUTES_ADD(DATETIME date, INT minutes)` +Add specified minutes from date time or date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is DATETIME. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select minutes_add("2020-02-02", 1); ++---------------------------------------+ +| minutes_add('2020-02-02 00:00:00', 1) | ++---------------------------------------+ +| 2020-02-02 00:01:00 | ++---------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + MINUTES_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/minutes_diff.md similarity index 58% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/minutes_diff.md index 24ad8a45813..484bd040de2 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/minutes_diff.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "minutes_diff", "language": "en" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## minutes_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT minutes_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The difference between the start time and the end time is a few minutes ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select minutes_diff('2020-12-25 22:00:00','2020-12-25 21:00:00'); ++------------------------------------------------------------+ +| minutes_diff('2020-12-25 22:00:00', '2020-12-25 21:00:00') | ++------------------------------------------------------------+ +| 60 | ++------------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + minutes_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/minutes_sub.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/minutes_sub.md index 24ad8a45813..1787f5076c2 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/minutes_sub.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "minutes_sub", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## minutes_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME MINUTES_SUB(DATETIME date, INT minutes)` +Subtracts a specified number of minutes from a datetime or date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is DATETIME. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select minutes_sub("2020-02-02 02:02:02", 1); ++---------------------------------------+ +| minutes_sub('2020-02-02 02:02:02', 1) | ++---------------------------------------+ +| 2020-02-02 02:01:02 | ++---------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + MINUTES_SUB diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/months_add.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/months_add.md index 24ad8a45813..87ccde928cb 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/months_add.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "months_add", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## months_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME MONTHS_ADD(DATETIME date, INT months)` +Add the specified month from the date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is consistent with that of the parameter date. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select months_add("2020-01-31 02:02:02", 1); ++--------------------------------------+ +| months_add('2020-01-31 02:02:02', 1) | ++--------------------------------------+ +| 2020-02-29 02:02:02 | ++--------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + MONTHS_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/months_diff.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/months_diff.md index 24ad8a45813..67398388c59 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/months_diff.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "months_diff", "language": "en" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## months_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT months_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The difference between the start time and the end time is months ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select months_diff('2020-12-25','2020-10-25'); ++-----------------------------------------------------------+ +| months_diff('2020-12-25 00:00:00', '2020-10-25 00:00:00') | ++-----------------------------------------------------------+ +| 2 | ++-----------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + months_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/months_sub.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/months_sub.md index 24ad8a45813..1e14612427f 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/months_sub.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "months_sub", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## months_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME MONTHS_SUB(DATETIME date, INT months)` +Subtracts a specified number of months from a datetime or date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is consistent with that of the parameter date. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select months_sub("2020-02-02 02:02:02", 1); ++--------------------------------------+ +| months_sub('2020-02-02 02:02:02', 1) | ++--------------------------------------+ +| 2020-01-02 02:02:02 | ++--------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + MONTHS_SUB diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/quarter.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/quarter.md index 24ad8a45813..82c971b7265 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/quarter.md @@ -1,11 +1,11 @@ --- { - "title": "utc_timestamp", + "title": "quarter", "language": "en" } --- -<!-- +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## quarter +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT quarter(DATETIME date)` +Returns the quarter to which the specified date belongs, as an INT -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context - -### example +### Example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select quarter('2022-09-22 17:00:00'); ++--------------------------------+ +| quarter('2022-09-22 17:00:00') | ++--------------------------------+ +| 3 | ++--------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + quarter diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/seconds_add.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/seconds_add.md index 24ad8a45813..659ed301f03 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/seconds_add.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "seconds_add", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## seconds_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME SECONDS_ADD(DATETIME date, INT seconds)` +ADD a specified number of seconds from a datetime or date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is DATETIME. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select seconds_add("2020-02-02 02:02:02", 1); ++---------------------------------------+ +| seconds_add('2020-02-02 02:02:02', 1) | ++---------------------------------------+ +| 2020-02-02 02:02:03 | ++---------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + SECONDS_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/seconds_diff.md similarity index 58% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/seconds_diff.md index 24ad8a45813..83282713847 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/seconds_diff.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "seconds_diff", "language": "en" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## seconds_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT seconds_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The difference between the start time and the end time is seconds ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select seconds_diff('2020-12-25 22:00:00','2020-12-25 21:00:00'); ++------------------------------------------------------------+ +| seconds_diff('2020-12-25 22:00:00', '2020-12-25 21:00:00') | ++------------------------------------------------------------+ +| 3600 | ++------------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + seconds_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/seconds_sub.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/seconds_sub.md index 24ad8a45813..9ef139994ae 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/seconds_sub.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "seconds_sub", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## seconds_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME SECONDS_SUB(DATETIME date, INT seconds)` +Subtracts a specified number of seconds from a datetime or date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is DATETIME. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select seconds_sub("2020-01-01 00:00:00", 1); ++---------------------------------------+ +| seconds_sub('2020-01-01 00:00:00', 1) | ++---------------------------------------+ +| 2019-12-31 23:59:59 | ++---------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + SECONDS_SUB diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md index 24ad8a45813..7716002e577 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md @@ -44,5 +44,6 @@ mysql> select utc_timestamp(),utc_timestamp() + 1; +---------------------+---------------------+ | 2019-07-10 12:31:18 | 20190710123119 | +---------------------+---------------------+ +``` ### keywords UTC_TIMESTAMP,UTC,TIMESTAMP diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/weeks_add.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/weeks_add.md index 24ad8a45813..3db45910938 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/weeks_add.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "weeks_add", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## weeks_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME WEEKS_ADD(DATETIME date, INT weeks)` +ADD a specified number of weeks from a datetime or date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is consistent with that of the parameter date. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select weeks_add("2020-02-02 02:02:02", 1); ++-------------------------------------+ +| weeks_add('2020-02-02 02:02:02', 1) | ++-------------------------------------+ +| 2020-02-09 02:02:02 | ++-------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + WEEKS_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/weeks_diff.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/weeks_diff.md index 24ad8a45813..82aa49db198 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/weeks_diff.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "weeks_diff", "language": "en" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## weeks_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT weeks_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The difference between the start time and the end time is weeks ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select weeks_diff('2020-12-25','2020-10-25'); ++----------------------------------------------------------+ +| weeks_diff('2020-12-25 00:00:00', '2020-10-25 00:00:00') | ++----------------------------------------------------------+ +| 8 | ++----------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + weeks_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/weeks_sub.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/weeks_sub.md index 24ad8a45813..14fbde60f1a 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/weeks_sub.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "weeks_sub", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## weeks_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME WEEKS_SUB(DATETIME date, INT weeks)` +Subtracts a specified number of weeks from a datetime or date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is consistent with that of the parameter date. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select weeks_sub("2020-02-02 02:02:02", 1); ++-------------------------------------+ +| weeks_sub('2020-02-02 02:02:02', 1) | ++-------------------------------------+ +| 2020-01-26 02:02:02 | ++-------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + WEEKS_SUB diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/year_floor.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/year_floor.md index 24ad8a45813..169655ba20c 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/year_floor.md @@ -1,11 +1,11 @@ --- { - "title": "utc_timestamp", + "title": "year_floor", "language": "en" } --- -<!-- +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## year_floor +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME year_floor(DATETIME date)` +Rounding down the specified time, reserving the field level to years, returns the DATETIME type -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context - -### example +### Example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select year_floor('2022-09-22 17:00:00'); ++-----------------------------------+ +| year_floor('2022-09-22 17:00:00') | ++-----------------------------------+ +| 2022-01-01 00:00:00 | ++-----------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + year_floor diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/years_add.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/years_add.md index 24ad8a45813..28f91a66254 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/years_add.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "years_add", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## years_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME YEARS_ADD(DATETIME date, INT years)` +ADD a specified number of years from a datetime or date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is consistent with that of the parameter date. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select years_add("2020-01-31 02:02:02", 1); ++-------------------------------------+ +| years_add('2020-01-31 02:02:02', 1) | ++-------------------------------------+ +| 2021-01-31 02:02:02 | ++-------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + YEARS_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/years_diff.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/years_diff.md index 24ad8a45813..c8598e2be05 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/years_diff.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "years_diff", "language": "en" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## years_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT years_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The difference between the start time and the end time is several years ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select years_diff('2020-12-25','2019-10-25'); ++----------------------------------------------------------+ +| years_diff('2020-12-25 00:00:00', '2019-10-25 00:00:00') | ++----------------------------------------------------------+ +| 1 | ++----------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + years_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/docs/sql-manual/sql-functions/date-time-functions/years_sub.md similarity index 59% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to docs/sql-manual/sql-functions/date-time-functions/years_sub.md index 24ad8a45813..e5ea4f3788e 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/docs/sql-manual/sql-functions/date-time-functions/years_sub.md @@ -1,6 +1,6 @@ --- { - "title": "utc_timestamp", + "title": "years_sub", "language": "en" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## years_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME YEARS_SUB(DATETIME date, INT years)` +Subtracts a specified number of years from a datetime or date -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +The parameter date can be DATETIME or DATE, and the return type is consistent with that of the parameter date. ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select years_sub("2020-02-02 02:02:02", 1); ++-------------------------------------+ +| years_sub('2020-02-02 02:02:02', 1) | ++-------------------------------------+ +| 2019-02-02 02:02:02 | ++-------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + YEARS_SUB diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/days_add.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/days_add.md index 24ad8a45813..4c47f4803c1 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/days_add.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "days_add", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## days_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME DAYS_ADD(DATETIME date, INT days)` +从日期时间或日期加上指定天数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型与参数 date 的类型一致。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select days_add(to_date("2020-02-02 02:02:02"), 1); ++---------------------------------------------+ +| days_add(to_date('2020-02-02 02:02:02'), 1) | ++---------------------------------------------+ +| 2020-02-03 | ++---------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + DAYS_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/days_diff.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/days_diff.md index 24ad8a45813..f3780983685 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/days_diff.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "days_diff", + "language": "zh-CN" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## days_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT days_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +开始时间到结束时间相差几天 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select days_diff('2020-12-25 22:00:00','2020-12-24 22:00:00'); ++---------------------------------------------------------+ +| days_diff('2020-12-25 22:00:00', '2020-12-24 22:00:00') | ++---------------------------------------------------------+ +| 1 | ++---------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + days_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/days_sub.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/days_sub.md index 24ad8a45813..7333b30ee39 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/days_sub.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "days_sub", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## days_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME DAYS_SUB(DATETIME date, INT days)` +从日期时间或日期减去指定天数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型与参数 date 的类型一致。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select days_sub("2020-02-02 02:02:02", 1); ++------------------------------------+ +| days_sub('2020-02-02 02:02:02', 1) | ++------------------------------------+ +| 2020-02-01 02:02:02 | ++------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + DAYS_SUB diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/extract.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/extract.md new file mode 100644 index 00000000000..e045b035cf3 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/extract.md @@ -0,0 +1,53 @@ +--- +{ + "title": "extract", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## extract +### description +#### Syntax + +`INT extract(unit FROM DATETIME)` + +提取DATETIME某个指定单位的值。单位可以为year, month, day, hour, minute或者second + +### Example + +``` +mysql> select extract(year from '2022-09-22 17:01:30') as year, + -> extract(month from '2022-09-22 17:01:30') as month, + -> extract(day from '2022-09-22 17:01:30') as day, + -> extract(hour from '2022-09-22 17:01:30') as hour, + -> extract(minute from '2022-09-22 17:01:30') as minute, + -> extract(second from '2022-09-22 17:01:30') as second; ++------+-------+------+------+--------+--------+ +| year | month | day | hour | minute | second | ++------+-------+------+------+--------+--------+ +| 2022 | 9 | 22 | 17 | 1 | 30 | ++------+-------+------+------+--------+--------+ +``` + +### keywords + + extract diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/hours_add.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/hours_add.md index 24ad8a45813..4ad788d6027 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/hours_add.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "hours_add", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## hours_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME HOURS_ADD(DATETIME date, INT hours)` +从日期时间或日期加上指定小时数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型为 DATETIME。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select hours_add("2020-02-02 02:02:02", 1); ++-------------------------------------+ +| hours_add('2020-02-02 02:02:02', 1) | ++-------------------------------------+ +| 2020-02-02 03:02:02 | ++-------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + HOURS_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/hours_diff.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/hours_diff.md index 24ad8a45813..27bf4a80ef5 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/hours_diff.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "hours_diff", + "language": "zh-CN" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## hours_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT hours_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +开始时间到结束时间相差几小时 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select hours_diff('2020-12-25 22:00:00','2020-12-25 21:00:00'); ++----------------------------------------------------------+ +| hours_diff('2020-12-25 22:00:00', '2020-12-25 21:00:00') | ++----------------------------------------------------------+ +| 1 | ++----------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + hours_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/hours_sub.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/hours_sub.md index 24ad8a45813..5cd215512b4 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/hours_sub.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "hours_sub", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## hours_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME HOURS_SUB(DATETIME date, INT hours)` +从日期时间或日期减去指定小时数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型为 DATETIME。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select hours_sub("2020-02-02 02:02:02", 1); ++-------------------------------------+ +| hours_sub('2020-02-02 02:02:02', 1) | ++-------------------------------------+ +| 2020-02-02 01:02:02 | ++-------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + HOURS_SUB diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/localtime.md similarity index 56% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/localtime.md index 24ad8a45813..fd943395df7 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/localtime.md @@ -1,11 +1,11 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "localtime,localtimestamp", + "language": "zh-CN" } --- -<!-- +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information @@ -24,25 +24,33 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## localtime,localtimestamp +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME localtime()` +`DATETIME localtimestamp()` +获得当前的时间,以Datetime类型返回 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context - -### example +### Example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select localtime(); ++---------------------+ +| localtime() | ++---------------------+ +| 2022-09-22 17:30:23 | ++---------------------+ + +mysql> select localtimestamp(); ++---------------------+ +| localtimestamp() | ++---------------------+ +| 2022-09-22 17:30:29 | ++---------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + localtime,localtimestamp diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/minutes_add.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/minutes_add.md index 24ad8a45813..3eb3bf81dc9 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/minutes_add.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "minutes_add", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## minutes_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME MINUTES_ADD(DATETIME date, INT minutes)` +从日期时间或日期加上指定分钟数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型为 DATETIME。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select minutes_add("2020-02-02", 1); ++---------------------------------------+ +| minutes_add('2020-02-02 00:00:00', 1) | ++---------------------------------------+ +| 2020-02-02 00:01:00 | ++---------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + MINUTES_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/minutes_diff.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/minutes_diff.md index 24ad8a45813..e1fd51d582c 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/minutes_diff.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "minutes_diff", + "language": "zh-CN" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## minutes_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT minutes_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +开始时间到结束时间相差几分钟 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select minutes_diff('2020-12-25 22:00:00','2020-12-25 21:00:00'); ++------------------------------------------------------------+ +| minutes_diff('2020-12-25 22:00:00', '2020-12-25 21:00:00') | ++------------------------------------------------------------+ +| 60 | ++------------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + minutes_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/minutes_sub.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/minutes_sub.md index 24ad8a45813..1aa78e53889 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/minutes_sub.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "minutes_sub", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## minutes_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME MINUTES_SUB(DATETIME date, INT minutes)` +从日期时间或日期减去指定分钟数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型为 DATETIME。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select minutes_sub("2020-02-02 02:02:02", 1); ++---------------------------------------+ +| minutes_sub('2020-02-02 02:02:02', 1) | ++---------------------------------------+ +| 2020-02-02 02:01:02 | ++---------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + MINUTES_SUB diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/months_add.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/months_add.md index 24ad8a45813..2711100da1a 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/months_add.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "months_add", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## months_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME MONTHS_ADD(DATETIME date, INT months)` +从日期加上指定月份 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型与参数 date 的类型一致。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select months_add("2020-01-31 02:02:02", 1); ++--------------------------------------+ +| months_add('2020-01-31 02:02:02', 1) | ++--------------------------------------+ +| 2020-02-29 02:02:02 | ++--------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + MONTHS_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/months_diff.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/months_diff.md index 24ad8a45813..5cb02f28303 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/months_diff.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "months_diff", + "language": "zh-CN" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## months_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT months_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +开始时间到结束时间相差几个月 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select months_diff('2020-12-25','2020-10-25'); ++-----------------------------------------------------------+ +| months_diff('2020-12-25 00:00:00', '2020-10-25 00:00:00') | ++-----------------------------------------------------------+ +| 2 | ++-----------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + months_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/months_sub.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/months_sub.md index 24ad8a45813..293e32673ab 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/months_sub.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "months_sub", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## months_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME MONTHS_SUB(DATETIME date, INT months)` +从日期时间或日期减去指定月份数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型与参数 date 的类型一致。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select months_sub("2020-02-02 02:02:02", 1); ++--------------------------------------+ +| months_sub('2020-02-02 02:02:02', 1) | ++--------------------------------------+ +| 2020-01-02 02:02:02 | ++--------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + MONTHS_SUB diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/quarter.md similarity index 56% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/quarter.md index 24ad8a45813..d0d96a0cfe0 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/quarter.md @@ -1,11 +1,11 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "quarter", + "language": "zh-CN" } --- -<!-- +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## quarter +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT quarter(DATETIME date)` +返回指定的日期所属季度,以INT类型返回 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context - -### example +### Example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select quarter('2022-09-22 17:00:00'); ++--------------------------------+ +| quarter('2022-09-22 17:00:00') | ++--------------------------------+ +| 3 | ++--------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + quarter diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/seconds_add.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/seconds_add.md index 24ad8a45813..f6b9d95ecee 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/seconds_add.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "seconds_add", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## seconds_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME SECONDS_ADD(DATETIME date, INT seconds)` +从日期时间或日期加上指定秒数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型为 DATETIME。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select seconds_add("2020-02-02 02:02:02", 1); ++---------------------------------------+ +| seconds_add('2020-02-02 02:02:02', 1) | ++---------------------------------------+ +| 2020-02-02 02:02:03 | ++---------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + SECONDS_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/seconds_diff.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/seconds_diff.md index 24ad8a45813..54c0c24fc9c 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/seconds_diff.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "seconds_diff", + "language": "zh-CN" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## seconds_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT seconds_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +开始时间到结束时间相差几秒 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select seconds_diff('2020-12-25 22:00:00','2020-12-25 21:00:00'); ++------------------------------------------------------------+ +| seconds_diff('2020-12-25 22:00:00', '2020-12-25 21:00:00') | ++------------------------------------------------------------+ +| 3600 | ++------------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + seconds_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/seconds_sub.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/seconds_sub.md index 24ad8a45813..f86ff41d02a 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/seconds_sub.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "seconds_sub", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## seconds_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME SECONDS_SUB(DATETIME date, INT seconds)` +从日期时间或日期减去指定秒数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型为 DATETIME。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select seconds_sub("2020-01-01 00:00:00", 1); ++---------------------------------------+ +| seconds_sub('2020-01-01 00:00:00', 1) | ++---------------------------------------+ +| 2019-12-31 23:59:59 | ++---------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + SECONDS_SUB diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/weeks_add.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/weeks_add.md index 24ad8a45813..9a7bf1767b4 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/weeks_add.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "weeks_add", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## weeks_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME WEEKS_ADD(DATETIME date, INT weeks)` +从日期加上指定星期数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型与参数 date 的类型一致。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select weeks_add("2020-02-02 02:02:02", 1); ++-------------------------------------+ +| weeks_add('2020-02-02 02:02:02', 1) | ++-------------------------------------+ +| 2020-02-09 02:02:02 | ++-------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + WEEKS_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/weeks_diff.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/weeks_diff.md index 24ad8a45813..8accec3cea1 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/weeks_diff.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "weeks_diff", + "language": "zh-CN" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## weeks_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT weeks_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +开始时间到结束时间相差几星期 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select weeks_diff('2020-12-25','2020-10-25'); ++----------------------------------------------------------+ +| weeks_diff('2020-12-25 00:00:00', '2020-10-25 00:00:00') | ++----------------------------------------------------------+ +| 8 | ++----------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + weeks_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/weeks_sub.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/weeks_sub.md index 24ad8a45813..736cef55fcb 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/weeks_sub.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "weeks_sub", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## weeks_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME WEEKS_SUB(DATETIME date, INT weeks)` +从日期时间或日期减去指定星期数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型与参数 date 的类型一致。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select weeks_sub("2020-02-02 02:02:02", 1); ++-------------------------------------+ +| weeks_sub('2020-02-02 02:02:02', 1) | ++-------------------------------------+ +| 2020-01-26 02:02:02 | ++-------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + WEEKS_SUB diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/year_floor.md similarity index 56% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/year_floor.md index 24ad8a45813..df7d6851bd6 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/year_floor.md @@ -1,11 +1,11 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "year_floor", + "language": "zh-CN" } --- -<!-- +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## year_floor +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME year_floor(DATETIME date)` +指定时间向下舍入,保留字段级别到年,返回DATETIME类型 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context - -### example +### Example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select year_floor('2022-09-22 17:00:00'); ++-----------------------------------+ +| year_floor('2022-09-22 17:00:00') | ++-----------------------------------+ +| 2022-01-01 00:00:00 | ++-----------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + year_floor diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/years_add.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/years_add.md index 24ad8a45813..864b188c569 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/years_add.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "years_add", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## years_add +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME YEARS_ADD(DATETIME date, INT years)` +从日期加上指定年数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型与参数 date 的类型一致。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select years_add("2020-01-31 02:02:02", 1); ++-------------------------------------+ +| years_add('2020-01-31 02:02:02', 1) | ++-------------------------------------+ +| 2021-01-31 02:02:02 | ++-------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + YEARS_ADD diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/years_diff.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/years_diff.md index 24ad8a45813..604c6723add 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/years_diff.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "years_diff", + "language": "zh-CN" } --- @@ -24,25 +24,25 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## years_diff +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`INT years_diff(DATETIME enddate, DATETIME startdate)` - -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +开始时间到结束时间相差几年 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select years_diff('2020-12-25','2019-10-25'); ++----------------------------------------------------------+ +| years_diff('2020-12-25 00:00:00', '2019-10-25 00:00:00') | ++----------------------------------------------------------+ +| 1 | ++----------------------------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + years_diff diff --git a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/years_sub.md similarity index 57% copy from docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/years_sub.md index 24ad8a45813..8a9be733681 100644 --- a/docs/sql-manual/sql-functions/date-time-functions/utc_timestamp.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/years_sub.md @@ -1,7 +1,7 @@ --- { - "title": "utc_timestamp", - "language": "en" + "title": "years_sub", + "language": "zh-CN" } --- @@ -24,25 +24,27 @@ specific language governing permissions and limitations under the License. --> -## utc_timestamp -### Description +## years_sub +### description #### Syntax -`DATETIME UTC_TIMESTAMP()` +`DATETIME YEARS_SUB(DATETIME date, INT years)` +从日期时间或日期减去指定年数 -Returns a value of the current UTC date and time in the format of "YYYY-MM-DD HH: MM: SS" or "YYYYMMDDHMMSS". - -Depending on whether the function is used in a string or numeric context +参数 date 可以是 DATETIME 或者 DATE 类型,返回类型与参数 date 的类型一致。 ### example ``` -mysql> select utc_timestamp(),utc_timestamp() + 1; -+---------------------+---------------------+ -| utc_timestamp() | utc_timestamp() + 1 | -+---------------------+---------------------+ -| 2019-07-10 12:31:18 | 20190710123119 | -+---------------------+---------------------+ +mysql> select years_sub("2020-02-02 02:02:02", 1); ++-------------------------------------+ +| years_sub('2020-02-02 02:02:02', 1) | ++-------------------------------------+ +| 2019-02-02 02:02:02 | ++-------------------------------------+ +``` + ### keywords -UTC_TIMESTAMP,UTC,TIMESTAMP + + YEARS_SUB diff --git a/sidebars.json b/sidebars.json index 1ee53be255e..9401edfce6b 100644 --- a/sidebars.json +++ b/sidebars.json @@ -232,39 +232,65 @@ "items": [ "sql-manual/sql-functions/date-time-functions/convert_tz", "sql-manual/sql-functions/date-time-functions/curdate", - "sql-manual/sql-functions/date-time-functions/current_timestamp", "sql-manual/sql-functions/date-time-functions/curtime", - "sql-manual/sql-functions/date-time-functions/date_add", - "sql-manual/sql-functions/date-time-functions/date_format", - "sql-manual/sql-functions/date-time-functions/date_sub", - "sql-manual/sql-functions/date-time-functions/datediff", + "sql-manual/sql-functions/date-time-functions/current_timestamp", + "sql-manual/sql-functions/date-time-functions/localtime", + "sql-manual/sql-functions/date-time-functions/now", + "sql-manual/sql-functions/date-time-functions/year", + "sql-manual/sql-functions/date-time-functions/quarter", + "sql-manual/sql-functions/date-time-functions/month", "sql-manual/sql-functions/date-time-functions/day", - "sql-manual/sql-functions/date-time-functions/dayname", + "sql-manual/sql-functions/date-time-functions/dayofyear", "sql-manual/sql-functions/date-time-functions/dayofmonth", "sql-manual/sql-functions/date-time-functions/dayofweek", - "sql-manual/sql-functions/date-time-functions/dayofyear", - "sql-manual/sql-functions/date-time-functions/from_days", - "sql-manual/sql-functions/date-time-functions/from_unixtime", + "sql-manual/sql-functions/date-time-functions/week", + "sql-manual/sql-functions/date-time-functions/weekday", + "sql-manual/sql-functions/date-time-functions/weekofyear", + "sql-manual/sql-functions/date-time-functions/yearweek", + "sql-manual/sql-functions/date-time-functions/dayname", + "sql-manual/sql-functions/date-time-functions/monthname", + "sql-manual/sql-functions/date-time-functions/year_floor", "sql-manual/sql-functions/date-time-functions/hour", - "sql-manual/sql-functions/date-time-functions/makedate", "sql-manual/sql-functions/date-time-functions/minute", - "sql-manual/sql-functions/date-time-functions/month", - "sql-manual/sql-functions/date-time-functions/monthname", - "sql-manual/sql-functions/date-time-functions/now", "sql-manual/sql-functions/date-time-functions/second", + "sql-manual/sql-functions/date-time-functions/from_days", + "sql-manual/sql-functions/date-time-functions/from_unixtime", + "sql-manual/sql-functions/date-time-functions/unix_timestamp", + "sql-manual/sql-functions/date-time-functions/utc_timestamp", + "sql-manual/sql-functions/date-time-functions/to_date", + "sql-manual/sql-functions/date-time-functions/to_days", + "sql-manual/sql-functions/date-time-functions/extract", + "sql-manual/sql-functions/date-time-functions/makedate", "sql-manual/sql-functions/date-time-functions/str_to_date", "sql-manual/sql-functions/date-time-functions/time_round", "sql-manual/sql-functions/date-time-functions/timediff", "sql-manual/sql-functions/date-time-functions/timestampadd", "sql-manual/sql-functions/date-time-functions/timestampdiff", - "sql-manual/sql-functions/date-time-functions/to_days", - "sql-manual/sql-functions/date-time-functions/unix_timestamp", - "sql-manual/sql-functions/date-time-functions/utc_timestamp", - "sql-manual/sql-functions/date-time-functions/week", - "sql-manual/sql-functions/date-time-functions/weekday", - "sql-manual/sql-functions/date-time-functions/weekofyear", - "sql-manual/sql-functions/date-time-functions/year", - "sql-manual/sql-functions/date-time-functions/yearweek" + "sql-manual/sql-functions/date-time-functions/date_add", + "sql-manual/sql-functions/date-time-functions/date_sub", + "sql-manual/sql-functions/date-time-functions/date_format", + "sql-manual/sql-functions/date-time-functions/datediff", + "sql-manual/sql-functions/date-time-functions/minutes_add", + "sql-manual/sql-functions/date-time-functions/minutes_diff", + "sql-manual/sql-functions/date-time-functions/minutes_sub", + "sql-manual/sql-functions/date-time-functions/seconds_add", + "sql-manual/sql-functions/date-time-functions/seconds_diff", + "sql-manual/sql-functions/date-time-functions/seconds_sub", + "sql-manual/sql-functions/date-time-functions/hours_add", + "sql-manual/sql-functions/date-time-functions/hours_diff", + "sql-manual/sql-functions/date-time-functions/hours_sub", + "sql-manual/sql-functions/date-time-functions/days_add", + "sql-manual/sql-functions/date-time-functions/days_diff", + "sql-manual/sql-functions/date-time-functions/days_sub", + "sql-manual/sql-functions/date-time-functions/weeks_add", + "sql-manual/sql-functions/date-time-functions/weeks_diff", + "sql-manual/sql-functions/date-time-functions/weeks_sub", + "sql-manual/sql-functions/date-time-functions/months_add", + "sql-manual/sql-functions/date-time-functions/months_diff", + "sql-manual/sql-functions/date-time-functions/months_sub", + "sql-manual/sql-functions/date-time-functions/years_add", + "sql-manual/sql-functions/date-time-functions/years_diff", + "sql-manual/sql-functions/date-time-functions/years_sub" ] }, { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org