morrySnow commented on code in PR #1821: URL: https://github.com/apache/doris-website/pull/1821#discussion_r1918307217
########## docs/sql-manual/sql-functions/scalar-functions/date-time-functions/hours-add.md: ########## @@ -24,27 +24,41 @@ specific language governing permissions and limitations under the License. --> -## hours_add -### description -#### Syntax +## Description -`DATETIME HOURS_ADD(DATETIME date, INT hours)` +Returns a new datetime value by adding the specified number of hours to the input datetime. -Add specified hours from date time or date +## Syntax -The parameter date can be DATETIME or DATE, and the return type is DATETIME. +```sql +DATETIME HOURS_ADD(DATETIME date, INT hours) +``` + +## Parameters + +| Parameter | Description | +| ---- | ---- | +| date | Input datetime value, type can be DATETIME or DATE | +| hours | Number of hours to add, type is INT | -### example +## Return Value +Returns a DATETIME type value. Review Comment: 也要说明返回值的含义,比如这个函数可以说:返回以 <date> 为基准,<hours> 小时后的时间值 ########## docs/sql-manual/sql-functions/scalar-functions/date-time-functions/hours-diff.md: ########## @@ -24,25 +24,41 @@ specific language governing permissions and limitations under the License. --> -## hours_diff -### description -#### Syntax +## Description -`INT hours_diff(DATETIME enddate, DATETIME startdate)` +Calculates the difference in hours between two datetime values. Returns the number of hours between enddate and startdate. -The difference between the start time and the end time is a few hours +## Syntax -### example +```sql +INT HOURS_DIFF(DATETIME enddate, DATETIME startdate) +``` + +## Parameters + +| Parameter | Description | +| ---- | ---- | +| enddate | End datetime value, type can be DATETIME or DATE | +| startdate | Start datetime value, type can be DATETIME or DATE | + +## Return Value +Returns an INT value representing the number of hours between the two datetime values. + +## Examples + +```sql +SELECT HOURS_DIFF('2020-12-25 22:00:00', '2020-12-25 21:00:00'); ``` -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 | -+----------------------------------------------------------+ + +```text ++--------------------------------------------------------------------------------------------------------+ +| hours_diff(cast('2020-12-25 22:00:00' as DATETIMEV2(0)), cast('2020-12-25 21:00:00' as DATETIMEV2(0))) | ++--------------------------------------------------------------------------------------------------------+ +| 1 | ++--------------------------------------------------------------------------------------------------------+ ``` -### keywords +## Keywords Review Comment: 不要keywords章节 ########## docs/sql-manual/sql-functions/scalar-functions/date-time-functions/hours-add.md: ########## @@ -24,27 +24,41 @@ specific language governing permissions and limitations under the License. --> -## hours_add -### description -#### Syntax +## Description -`DATETIME HOURS_ADD(DATETIME date, INT hours)` +Returns a new datetime value by adding the specified number of hours to the input datetime. -Add specified hours from date time or date +## Syntax -The parameter date can be DATETIME or DATE, and the return type is DATETIME. +```sql +DATETIME HOURS_ADD(DATETIME date, INT hours) Review Comment: ```suggestion HOURS_ADD(<date>, <hours>) ``` -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org