zclllyybb commented on code in PR #2810: URL: https://github.com/apache/doris-website/pull/2810#discussion_r2346903529
########## i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/hour-ceil.md: ########## Review Comment: ceil和floor都看之前pr的评论统一改一下 ########## i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/makedate.md: ########## @@ -7,39 +7,76 @@ ## 描述 -根据指定的年份和一年中的天数(dayofyear)构建并返回一个日期。 +MAKEDATE 函数用于根据指定的年份和一年中的天数(dayofyear)构建并返回对应的日期。该函数通过计算 “年份的第一天 + 天数偏移” 生成结果,支持对超出当年天数的输入进行自动顺延处理。 -特殊情况: -- 当 `<day_of_year>` 小于等于 0 时,返回 NULL -- 当 `<day_of_year>` 超过当年天数时,会自动往后顺延到下一年 +该函数与 mysql 中的 [makedate 函数](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_makedate) 行为一致。 ## 语法 ```sql -MAKEDATE(<year>, <day_of_year>) +MAKEDATE(`<year>`, `<day_of_year>`) ``` ## 参数 | 参数 | 说明 | | ---- | ---- | -| year | 指定的年份,类型为 INT | -| dayofyear | 一年中的第几天(1-366),类型为 INT | +| `year` | 指定的年份,类型为 INT,支持的有效范围为 0 至 9999 | +| `dayofyear` | 一年中的第几天(1-366),类型为 INT | ## 返回值 -返回类型为 DATE,返回以指定年份和一年中的第几天构建的日期。 +返回 DATE 类型的值,表示根据输入的年份和天数计算得到的日期(格式为 YYYY-MM-DD)。 + +- 若 `<day_of_year>` 小于等于 0,返回错误。 +- 若 `<day_of_year>` 超过指定年份的总天数(平年 365 天,闰年 366 天),则自动顺延到下一年及以后的年份(例如:2021 年(平年)的第 366 天会顺延为 2022-01-01)。 +- 计算结果超出有效日期范围(0000-01-01 至 9999-12-31),返回错误 Review Comment: 等待行为变更 ########## i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/localtime.md: ########## @@ -8,11 +8,13 @@ ## 描述 函数用于获取当前系统时间,返回值为日期时间类型(`DATETIME`)。可以选择性地指定精度以调整返回值的小数秒部分的位数。 Review Comment: link一下now的文档,是别名 ########## i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/localtime.md: ########## @@ -28,13 +30,27 @@ LOCALTIMESTAMP([<precision>])) ## 举例 ```sql -select LOCALTIME(),LOCALTIME(3),LOCALTIME(6); -``` -```text +--jdk 17 版本,可以支持六位精度 Review Comment: 移除关于jdk的说明 ########## i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/microsecond.md: ########## @@ -7,34 +7,73 @@ ## 描述 -从日期时间值中提取微秒部分的值。返回的范围是 0 到 999999。 +MICROSECOND 函数用于从输入的日期时间值中提取微秒部分(即小数点后第六位及以内的数值),返回范围为 0 到 999999。该函数支持处理含微秒精度的 DATETIME 类型,对于精度不足的输入会自动补 0。 ## 语法 ```sql -MICROSECOND(<date>) +MICROSECOND(`<datetime>`) ``` ## 参数 | 参数 | 说明 | | ---- | ---- | -| `<date>` | 输入的日期时间值,类型为 DATETIMEV2,精度需要大于 0 | +| `<datetime>` | 输入的日期时间值,类型为 DATETIME , datetime格式请查看 [datetime 的转换](../../../../../current/sql-manual/basic-element/sql-data-types/conversion/datetime-conversion),精度需要大于 0 | + + +该函数与 mysql 中的 [microsecond 函数](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_microsecond) 行为一致。 Review Comment: 这种说明在各个文档里的位置应该一致 ########## i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md: ########## @@ -7,46 +7,86 @@ ## 描述 -获得日期时间中的小时的信息。 +HOUR 函数用于提取日期时间或时间表达式中的小时部分。该函数支持多种时间类型输入,包括 DATE/DATETIME、TIME ,返回对应小时数值。 + +对于 DATETIME (如 '2023-10-01 14:30:00'),返回值范围为 0-23(24 小时制)。 +对于 TIME 类型(如 '456:26:32'),返回值可超出 24,范围为 [0,838]。 + +该函数与 mysql 中的 [hour 函数](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_hour) 行为一致。 ## 语法 ```sql -HOUR(<dt>) +HOUR(`<date_or_time_expr>`) ``` ## 参数 | 参数 | 说明 | | -- | -- | -| `<dt>` | 需要计算的日期 | +| `<date_or_time_expr>` | 参数是合法的日期表达式,支持输入 datetime/date/time 类型,date 类型会转换为对应日期的一天起始时间 00:00:00 ,具体 datetime/date/time 格式请查看 [datetime 的转换](../../../../../current/sql-manual/basic-element/sql-data-types/conversion/datetime-conversion) 和 [date 的转换](../../../../../current/sql-manual/basic-element/sql-data-types/conversion/date-conversion) 和 [time的转换](../../../../../current/sql-manual/basic-element/sql-data-types/conversion/time-conversion) | ## 返回值 -返回日期中的小时的信息。返回值范围从 0-23。当参数为 Time,返回值可以大于 24 +返回整数类型(INT),表示输入表达式中的小时部分。 Review Comment: 添加个说明吧,time的返回的是绝对值,没有负数 ########## i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/hours-diff.md: ########## @@ -7,35 +7,80 @@ ## 描述 -开始时间到结束时间相差几小时。 +HOURS_DIFF 函数用于计算两个日期时间或日期之间的小时差值,即从起始时间到结束时间所经过的小时数。该函数支持 DATE 和 DATETIME 两种输入类型,自动处理跨天、跨月、跨年的时间差计算,并返回整数结果,若输入为 DATE 类型(仅包含年月日),默认其时间部分为 00:00:00 + ## 语法 ```sql -HOURS_DIFF(<end_date>, <start_date>) +HOURS_DIFF(`<date_or_time_expr1>`, `<date_or_time_expr2>`) ``` ## 参数 | 参数 | 说明 | | ---- | ---- | -| `<end_date>` | 结束时间,类型为 DATETIME 或 DATE | -| `<start_date>` | 开始时间,类型为 DATETIME 或 DATE | +| `<date_or_time_expr1>` | 结束时间,参数是合法的日期表达式,支持输入 date/datetime 类型,具体 datetime,date格式请查看 [datetime 的转换](../../../../../current/sql-manual/basic-element/sql-data-types/conversion/datetime-conversion) 和 [date 的转换](../../../../../current/sql-manual/basic-element/sql-data-types/conversion/date-conversion)| +| `<start_date>` | 开始时间,参数是合法的日期表达式,支持输入 date/datetime 类型和符合日期时间格式的字符串 | ## 返回值 -返回类型为 INT,返回开始时间到结束时间相差的小时数。 +返回类型为 BIGINT,表示 `<date_or_time_expr1>` 与 `<date_or_time_expr2>` 之间的小时差值 +- 若 `<date_or_time_expr1>` 晚于 `<date_or_time_expr2>`,返回正数;若早于,则返回负数。 +- 若输入参数为 NULL,返回 NULL。 +- 包含分钟时间,若实际差值不足一小时,计算结果减一 Review Comment: 包含分钟及以下时间单位 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
