From 0ad4ffd0ca4c7d741fd28947fa8c01e7d8ad6d7c Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Fri, 23 Aug 2024 16:39:18 +0800 Subject: [PATCH] docs:[TD-31673] Update description of timetruncate function to clarify week truncation behavior based on Unix epoch starting on Thursday. --- docs/en/14-reference/03-taos-sql/10-function.md | 1 + docs/zh/14-reference/03-taos-sql/10-function.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/en/14-reference/03-taos-sql/10-function.md b/docs/en/14-reference/03-taos-sql/10-function.md index e130442279..72ca878ce8 100644 --- a/docs/en/14-reference/03-taos-sql/10-function.md +++ b/docs/en/14-reference/03-taos-sql/10-function.md @@ -656,6 +656,7 @@ use_current_timezone: { For example, if the time zone configured by the Client is UTC + 0800, TIMETRUNCATE ('2020-01-01 23:00:00', 1d, 0) returns the result of '2020-01-01 08:00:00'. When using TIMETRUNCATE ('2020-01-01 23:00:00', 1d, 1), the result is 2020-01-01 00:00:00 '. When use_current_timezone is not specified, use_current_timezone defaults to 1. +- When truncating a time value to the week (1w), weeks are determined using the Unix epoch (1970-01-01T00:00:00Z UTC). The Unix epoch was on a Thursday, so all calculated weeks begin on Thursday. #### TIMEZONE diff --git a/docs/zh/14-reference/03-taos-sql/10-function.md b/docs/zh/14-reference/03-taos-sql/10-function.md index ca6ba378ca..ac9311184e 100644 --- a/docs/zh/14-reference/03-taos-sql/10-function.md +++ b/docs/zh/14-reference/03-taos-sql/10-function.md @@ -656,7 +656,8 @@ use_current_timezone: { 例如客户端所配置时区为 UTC+0800, 则 TIMETRUNCATE('2020-01-01 23:00:00', 1d, 0) 返回结果为东八区时间 '2020-01-01 08:00:00'。 而使用 TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) 时,返回结果为东八区时间 '2020-01-01 00:00:00'。 当不指定 use_current_timezone 时,use_current_timezone 默认值为 1 。 - +- 当将时间值截断到一周(1w)时,timetruncate 的计算是基于 Unix 时间戳(1970年1月1日00:00:00 UTC)进行的。Unix 时间戳始于星期四, + 因此所有截断后的日期都是星期四。 #### TIMEZONE