bingquanzhao commented on code in PR #1805:
URL: https://github.com/apache/doris-website/pull/1805#discussion_r1917852236
##########
docs/sql-manual/sql-functions/scalar-functions/date-time-functions/months-add.md:
##########
@@ -24,27 +24,40 @@ specific language governing permissions and limitations
under the License.
-->
-## months_add
-### description
-#### Syntax
+## Description
+The MONTHS_ADD function is used to add or subtract a specified number of
months to a given date and returns the resulting date.
-`DATETIME MONTHS_ADD(DATETIME date, INT months)`
+## Syntax
-Add the specified month from the date
+`DATETIME MONTHS_ADD(DATETIME/DATE <datetime/date>, INT <nums>)`
-The parameter date can be DATETIME or DATE, and the return type is consistent
with that of the parameter date.
+## Parameters
-### example
+| Parameter | Description
|
+|-------------------|------------------------------------------------------------|
+| `<datetime/date>` | The date value to which months will be added or
subtracted |
+| `<nums>` | The number of months to add or subtract
|
+## Return Value
+The return value is of the same type as the input <datetime/date>.
+Special cases:
+- If the <datetime/date> input is 0000-00-00 or 0000-00-00 00:00:00, the
function returns NULL.
+- If the <datetime/date> input is NULL, the function returns NULL.
+- If the input is MONTHS_ADD("9999-12-31", 1), the function will return NULL.
+
+## Example
+
+``` sql
+select months_add("2020-01-31 02:02:02", 1),months_add("2020-01-31",
1),months_add("2020-01-31", -1);
```
-mysql> select months_add("2020-01-31 02:02:02", 1);
-+--------------------------------------+
-| months_add('2020-01-31 02:02:02', 1) |
-+--------------------------------------+
-| 2020-02-29 02:02:02 |
-+--------------------------------------+
+```text
++-------------------------------------------------------------+---------------------------------------------+----------------------------------------------+
+| months_add(cast('2020-01-31 02:02:02' as DATETIMEV2(0)), 1) |
months_add(cast('2020-01-31' as DATEV2), 1) | months_add(cast('2020-01-31' as
DATEV2), -1) |
++-------------------------------------------------------------+---------------------------------------------+----------------------------------------------+
+| 2020-02-29 02:02:02 | 2020-02-29
| 2019-12-31 |
++-------------------------------------------------------------+---------------------------------------------+----------------------------------------------+
```
-### keywords
+## keywords
Review Comment:
get
--
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]