morrySnow commented on code in PR #2197: URL: https://github.com/apache/doris-website/pull/2197#discussion_r1997896941
########## docs/sql-manual/sql-functions/scalar-functions/date-time-functions/weeks-diff.md: ########## @@ -24,25 +24,58 @@ specific language governing permissions and limitations under the License. --> -## weeks_diff -### description -#### Syntax +## Description +Calculates the number of complete weeks (in 7-day units) between two date or time values. -`INT weeks_diff(DATETIME enddate, DATETIME startdate)` +## Syntax -The difference between the start time and the end time is weeks +```sql +WEEKS_DIFF([<end_date> | <end_datetime>], [<start_date> | <start_datetime>]) Review Comment: ```suggestion WEEKS_DIFF(<end_date> <start_date>) ``` ########## docs/sql-manual/sql-functions/scalar-functions/date-time-functions/weeks-diff.md: ########## @@ -24,25 +24,58 @@ specific language governing permissions and limitations under the License. --> -## weeks_diff -### description -#### Syntax +## Description +Calculates the number of complete weeks (in 7-day units) between two date or time values. -`INT weeks_diff(DATETIME enddate, DATETIME startdate)` +## Syntax -The difference between the start time and the end time is weeks +```sql +WEEKS_DIFF([<end_date> | <end_datetime>], [<start_date> | <start_datetime>]) +``` -### example +## Optional parameters +| Parameter name | Data type | Description | +|----------------------|------------|----------------------| +| **`end_date`** | `DATE` | Later date | +| **`end_datetime`** | `DATETIME` | Later datetime | +| **`start_date`** | `DATE` | Earlier date | +| **`start_datetime`** | `DATETIME` | Earlier datetime | Review Comment: 在这里解释一下可以处理 date / datetime 就可以了 ########## docs/sql-manual/sql-functions/scalar-functions/date-time-functions/weeks-sub.md: ########## @@ -24,27 +24,47 @@ specific language governing permissions and limitations under the License. --> -## weeks_sub -### description -#### Syntax -`DATETIME WEEKS_SUB(DATETIME date, INT weeks)` +## Description +## Syntax +```sql +WEEKS_SUB([<date_value> | <datetime_value>], <week_period>) +``` -Subtracts a specified number of weeks from a datetime or date +## Required parameters +**<week_period>** +> Integer representing the number of weeks to be reduced (positive number means reduction, negative number means increase). -The parameter date can be DATETIME or DATE, and the return type is consistent with that of the parameter date. +## Optional parameters +- **<date_value>** + > Date input value of type `DATE` -### example +- **<datetime_value>** + > Date and time input value of type `DATETIME` Review Comment: 使用表格 ########## docs/sql-manual/sql-functions/scalar-functions/date-time-functions/weeks-sub.md: ########## @@ -24,27 +24,47 @@ specific language governing permissions and limitations under the License. --> -## weeks_sub -### description -#### Syntax -`DATETIME WEEKS_SUB(DATETIME date, INT weeks)` +## Description Review Comment: 缺少函数描述 ########## docs/sql-manual/sql-functions/scalar-functions/date-time-functions/year-floor.md: ########## @@ -24,39 +24,94 @@ specific language governing permissions and limitations under the License. --> -## year_floor -### description -#### Syntax -```sql -DATETIME YEAR_FLOOR(DATETIME datetime) -DATETIME YEAR_FLOOR(DATETIME datetime, DATETIME origin) -DATETIME YEAR_FLOOR(DATETIME datetime, INT period) -DATETIME YEAR_FLOOR(DATETIME datetime, INT period, DATETIME origin) -``` +## Description +It is used to round the given date down to the specified year interval starting point. It supports multiple variants, which can specify the starting time (origin) and period (period) in different ways to round. -Convert the date to the nearest rounding down time of the specified time interval period. +## Syntax -- datetime: a valid date expression. -- period: specifies how many years each cycle consists of. -- origin: starting from 0001-01-01T00:00:00. +```sql +YEAR_FLOOR([<datetime_value> | <date_value>]) | Review Comment: datetime 和 date 就用一个参数表示就可以,在参数说明章节,说清楚可以是date 或者 datetime 就好了 ########## docs/sql-manual/sql-functions/scalar-functions/date-time-functions/weeks-sub.md: ########## @@ -24,27 +24,47 @@ specific language governing permissions and limitations under the License. --> -## weeks_sub -### description -#### Syntax -`DATETIME WEEKS_SUB(DATETIME date, INT weeks)` +## Description +## Syntax +```sql +WEEKS_SUB([<date_value> | <datetime_value>], <week_period>) Review Comment: ```suggestion WEEKS_SUB(<date_value>, <week_period>) ``` ########## docs/sql-manual/sql-functions/scalar-functions/date-time-functions/weeks-diff.md: ########## @@ -24,25 +24,58 @@ specific language governing permissions and limitations under the License. --> -## weeks_diff -### description -#### Syntax +## Description +Calculates the number of complete weeks (in 7-day units) between two date or time values. -`INT weeks_diff(DATETIME enddate, DATETIME startdate)` +## Syntax -The difference between the start time and the end time is weeks +```sql +WEEKS_DIFF([<end_date> | <end_datetime>], [<start_date> | <start_datetime>]) +``` -### example +## Optional parameters Review Comment: ```suggestion ## Parameters ``` ########## docs/sql-manual/sql-functions/scalar-functions/date-time-functions/to-date.md: ########## @@ -24,25 +24,29 @@ specific language governing permissions and limitations under the License. --> -## to_date -### description -#### Syntax -`DATE TO_DATE(DATETIME)` +## Description +Date conversion function, used to convert a date time string or timestamp to a date type (DATE), that is, remove the time part and keep only the date (YYYY-MM-DD) -Return the DATE part of DATETIME value. +## Syntax +```sql +TO_DATE(<datetime_value>) +``` + +## Required parameter +**datetime_value**: datetime type datetime Review Comment: function doc's parameter should put into a table. -- 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