You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by lu...@apache.org on 2023/04/06 01:04:14 UTC

[doris] branch master updated: [doc](datetimefunction)Supplement the description and case of days_diff (#18244)

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

luzhijing 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 d305c459a1 [doc](datetimefunction)Supplement the description and case of days_diff (#18244)
d305c459a1 is described below

commit d305c459a17a8b319b7ac354d4959ebef4a25645
Author: Jiwen liu <61...@users.noreply.github.com>
AuthorDate: Thu Apr 6 09:04:08 2023 +0800

    [doc](datetimefunction)Supplement the description and case of days_diff (#18244)
---
 .../sql-manual/sql-functions/date-time-functions/days_diff.md |  9 ++++++++-
 docs/zh-CN/docs/ecosystem/mysql-to-doris.md                   |  4 ++--
 .../sql-manual/sql-functions/date-time-functions/days_diff.md | 11 +++++++++--
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/docs/en/docs/sql-manual/sql-functions/date-time-functions/days_diff.md b/docs/en/docs/sql-manual/sql-functions/date-time-functions/days_diff.md
index 183fe927b1..3407690286 100644
--- a/docs/en/docs/sql-manual/sql-functions/date-time-functions/days_diff.md
+++ b/docs/en/docs/sql-manual/sql-functions/date-time-functions/days_diff.md
@@ -30,7 +30,7 @@ under the License.
 
 `INT days_diff(DATETIME enddate, DATETIME startdate)`
 
-The difference between the start time and the end time is a few days
+The difference between the start time and the end time is a few days, the date judgment is accurate to seconds and rounded down to an integer. This is different from date_diff function, which only provides accuracy up to days."
 
 ### example
 
@@ -41,6 +41,13 @@ mysql> select days_diff('2020-12-25 22:00:00','2020-12-24 22:00:00');
 +---------------------------------------------------------+
 |                                                       1 |
 +---------------------------------------------------------+
+
+mysql> select days_diff('2020-12-25 22:00:00','2020-12-24 22:00:01');
++---------------------------------------------------------+
+| days_diff('2020-12-24 22:00:01', '2020-12-25 22:00:00') |
++---------------------------------------------------------+
+|                                                       0 |
++---------------------------------------------------------+
 ```
 
 ### keywords
diff --git a/docs/zh-CN/docs/ecosystem/mysql-to-doris.md b/docs/zh-CN/docs/ecosystem/mysql-to-doris.md
index 56a5bb7891..f08b192c9e 100644
--- a/docs/zh-CN/docs/ecosystem/mysql-to-doris.md
+++ b/docs/zh-CN/docs/ecosystem/mysql-to-doris.md
@@ -93,7 +93,7 @@ mysql to doris 代码[这里](https://github.com/apache/doris/tree/master/extens
 sh all_tables.sh mysql_db_name doris_db_name
 ```
 
-执行成功后会生成 files目录,改目录包含`tables`(表名称) 和 `tables.sql` (doris odbc建表语句)
+执行成功后会生成 files目录,该目录包含`tables`(表名称) 和 `tables.sql` (doris odbc建表语句)
 
 ### 自定义
 
@@ -105,4 +105,4 @@ sh all_tables.sh mysql_db_name doris_db_name
 sh user_define_tables.sh mysql_db_name doris_db_name
 ```
 
-执行成功后会生成 user_files目录,改目录包含 `tables.sql` (doris odbc建表语句)
+执行成功后会生成 user_files目录,该目录包含 `tables.sql` (doris odbc建表语句)
diff --git a/docs/zh-CN/docs/sql-manual/sql-functions/date-time-functions/days_diff.md b/docs/zh-CN/docs/sql-manual/sql-functions/date-time-functions/days_diff.md
index f378098368..6eae929d87 100644
--- a/docs/zh-CN/docs/sql-manual/sql-functions/date-time-functions/days_diff.md
+++ b/docs/zh-CN/docs/sql-manual/sql-functions/date-time-functions/days_diff.md
@@ -30,8 +30,8 @@ under the License.
 
 `INT days_diff(DATETIME enddate, DATETIME startdate)`
 
-开始时间到结束时间相差几天
-
+开始时间到结束时间相差几天,对日期的判断精确到秒,并向下取整数。
+区别于date_diff,datediff函数对日期的判断精确到天。
 ### example
 
 ```
@@ -41,6 +41,13 @@ mysql> select days_diff('2020-12-25 22:00:00','2020-12-24 22:00:00');
 +---------------------------------------------------------+
 |                                                       1 |
 +---------------------------------------------------------+
+
+mysql> select days_diff('2020-12-25 22:00:00','2020-12-24 22:00:01');
++---------------------------------------------------------+
+| days_diff('2020-12-24 22:00:01', '2020-12-25 22:00:00') |
++---------------------------------------------------------+
+|                                                       0 |
++---------------------------------------------------------+
 ```
 
 ### keywords


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org