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.git
The following commit(s) were added to refs/heads/master by this push: new b398fd60fc [DOCS](function) Add docs for new time functions (#12382) b398fd60fc is described below commit b398fd60fc5ce55b0ce2ed17857d3c253fa1e372 Author: Gabriel <gabrielleeb...@gmail.com> AuthorDate: Tue Sep 6 19:33:41 2022 +0800 [DOCS](function) Add docs for new time functions (#12382) Add docs for new time functions --- .../date-time-functions/current_timestamp.md | 22 ++++++++++++++++++++ .../sql-functions/date-time-functions/now.md | 24 +++++++++++++++++++++- .../date-time-functions/current_timestamp.md | 21 +++++++++++++++++++ .../sql-functions/date-time-functions/now.md | 21 +++++++++++++++++++ 4 files changed, 87 insertions(+), 1 deletion(-) diff --git a/docs/en/docs/sql-manual/sql-functions/date-time-functions/current_timestamp.md b/docs/en/docs/sql-manual/sql-functions/date-time-functions/current_timestamp.md index 412f0a095d..4aa391d36e 100644 --- a/docs/en/docs/sql-manual/sql-functions/date-time-functions/current_timestamp.md +++ b/docs/en/docs/sql-manual/sql-functions/date-time-functions/current_timestamp.md @@ -43,5 +43,27 @@ mysql> select current_timestamp(); | 2019-05-27 15:59:33 | +---------------------+ ``` + +`DATETIMEV2 NOW(INT precision)` + + +Get the current time and return it in DatetimeV2 type. +Precision represents the second precision that the user wants. The current precision supports up to microseconds, that is, the value range of precision is [0, 6]. + +### example + +``` +mysql> select current_timestamp(3); ++-------------------------+ +| current_timestamp(3) | ++-------------------------+ +| 2022-09-06 16:18:00.922 | ++-------------------------+ +``` + +Note: +1. Currently, only DatetimeV2 type supports precision. +2. Limited by the JDK implementation, if you use jdk8 to build FE, the precision can be up to milliseconds (three decimal places), and the larger precision bits will be filled with 0. If you need higher accuracy, please use jdk11 to build FE. + ### keywords CURRENT_TIMESTAMP,CURRENT,TIMESTAMP diff --git a/docs/en/docs/sql-manual/sql-functions/date-time-functions/now.md b/docs/en/docs/sql-manual/sql-functions/date-time-functions/now.md index 4fd9fd8e11..1a572a60d4 100644 --- a/docs/en/docs/sql-manual/sql-functions/date-time-functions/now.md +++ b/docs/en/docs/sql-manual/sql-functions/date-time-functions/now.md @@ -31,7 +31,7 @@ under the License. `DATETIME NOW ()` -Get the current time and return it in Datetime type +Get the current time and return it in Datetime type. ### example @@ -43,5 +43,27 @@ mysql> select now(); | 2019-05-27 15:58:25 | +---------------------+ ``` + +`DATETIMEV2 NOW(INT precision)` + + +Get the current time and return it in DatetimeV2 type. +Precision represents the second precision that the user wants. The current precision supports up to microseconds, that is, the value range of precision is [0, 6]. + +### example + +``` +mysql> select now(3); ++-------------------------+ +| now(3) | ++-------------------------+ +| 2022-09-06 16:13:30.078 | ++-------------------------+ +``` + +Note: +1. Currently, only DatetimeV2 type supports precision. +2. Limited by the JDK implementation, if you use jdk8 to build FE, the precision can be up to milliseconds (three decimal places), and the larger precision bits will be filled with 0. If you need higher accuracy, please use jdk11 to build FE. + ### keywords NOW diff --git a/docs/zh-CN/docs/sql-manual/sql-functions/date-time-functions/current_timestamp.md b/docs/zh-CN/docs/sql-manual/sql-functions/date-time-functions/current_timestamp.md index 53ca1dfeed..41755420ce 100644 --- a/docs/zh-CN/docs/sql-manual/sql-functions/date-time-functions/current_timestamp.md +++ b/docs/zh-CN/docs/sql-manual/sql-functions/date-time-functions/current_timestamp.md @@ -44,6 +44,27 @@ mysql> select current_timestamp(); +---------------------+ ``` +`DATETIMEV2 CURRENT_TIMESTAMP(INT precision)` + + +获得当前的时间,以DatetimeV2类型返回 +precision代表了用户想要的秒精度,当前精度最多支持到微秒,即precision取值范围为[0, 6]。 + +### example + +``` +mysql> select current_timestamp(3); ++-------------------------+ +| current_timestamp(3) | ++-------------------------+ +| 2022-09-06 16:18:00.922 | ++-------------------------+ +``` + +注意: +1. 当前只有DatetimeV2数据类型可支持秒精度 +2. 受限于JDK实现,如果用户使用JDK8构建FE,则精度最多支持到毫秒(小数点后三位),更大的精度位将全部填充0。如果用户有更高精度需求,请使用JDK11。 + ### keywords CURRENT_TIMESTAMP,CURRENT,TIMESTAMP diff --git a/docs/zh-CN/docs/sql-manual/sql-functions/date-time-functions/now.md b/docs/zh-CN/docs/sql-manual/sql-functions/date-time-functions/now.md index 454a6ce61d..dbead700a6 100644 --- a/docs/zh-CN/docs/sql-manual/sql-functions/date-time-functions/now.md +++ b/docs/zh-CN/docs/sql-manual/sql-functions/date-time-functions/now.md @@ -44,6 +44,27 @@ mysql> select now(); +---------------------+ ``` +`DATETIMEV2 NOW(INT precision)` + + +获得当前的时间,以DatetimeV2类型返回 +precision代表了用户想要的秒精度,当前精度最多支持到微秒,即precision取值范围为[0, 6]。 + +### example + +``` +mysql> select now(3); ++-------------------------+ +| now(3) | ++-------------------------+ +| 2022-09-06 16:13:30.078 | ++-------------------------+ +``` + +注意: +1. 当前只有DatetimeV2数据类型可支持秒精度 +2. 受限于JDK实现,如果用户使用JDK8构建FE,则精度最多支持到毫秒(小数点后三位),更大的精度位将全部填充0。如果用户有更高精度需求,请使用JDK11。 + ### keywords NOW --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org