-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add doc of now() and sysdate() (#1042)
* add doc of now() and sysdate() * fix
- Loading branch information
Showing
4 changed files
with
117 additions
and
1 deletion.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
docs/MatrixOne/Reference/Functions-and-Operators/Datetime/now.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# NOW() | ||
|
||
## 函数说明 | ||
|
||
`NOW()` 函数返回当前日期和时间的 'YYYY-MM-DD HH:MM:SS' 格式的值。 | ||
|
||
`NOW()` 返回语句开始执行的时间。这与 [`SYSDATE()`](sysdate.md) 的行为不同,后者返回执行过程中动态的实时时间。 | ||
|
||
## 函数语法 | ||
|
||
``` | ||
> NOW(fsp) | ||
``` | ||
|
||
## 参数释义 | ||
|
||
| 参数 | 说明 | | ||
| ---- | ---- | | ||
| fsp | 非必要参数。如果给定 fsp 参数以指定从 0 到 6 的小数秒精度,则返回值包括该数字的小数秒部分。| | ||
|
||
## 示例 | ||
|
||
```sql | ||
mysql> select now(); | ||
+----------------------------+ | ||
| now() | | ||
+----------------------------+ | ||
| 2024-04-29 08:03:50.479238 | | ||
+----------------------------+ | ||
1 row in set (0.03 sec) | ||
|
||
mysql> select now(6); | ||
+----------------------------+ | ||
| now(6) | | ||
+----------------------------+ | ||
| 2024-04-29 08:05:26.528629 | | ||
+----------------------------+ | ||
1 row in set (0.02 sec) | ||
|
||
mysql> SELECT NOW(), SLEEP(2), NOW(); | ||
+----------------------------+----------+----------------------------+ | ||
| now() | sleep(2) | now() | | ||
+----------------------------+----------+----------------------------+ | ||
| 2024-04-29 08:17:23.876546 | 0 | 2024-04-29 08:17:23.876546 | | ||
+----------------------------+----------+----------------------------+ | ||
1 row in set (2.06 sec) | ||
|
||
mysql> SELECT SYSDATE(), SLEEP(2), SYSDATE(); | ||
+----------------------------+----------+----------------------------+ | ||
| sysdate() | sleep(2) | sysdate() | | ||
+----------------------------+----------+----------------------------+ | ||
| 2024-04-29 16:19:21.439725 | 0 | 2024-04-29 16:19:23.440187 | | ||
+----------------------------+----------+----------------------------+ | ||
1 row in set (2.01 sec) | ||
|
||
``` |
56 changes: 56 additions & 0 deletions
56
docs/MatrixOne/Reference/Functions-and-Operators/Datetime/sysdate.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# SYSDATE() | ||
|
||
## 函数说明 | ||
|
||
`SYSDATE()` 函数返回当前日期和时间的 'YYYY-MM-DD HH:MM:SS' 格式的值。 | ||
|
||
`SYSDATE()` 返回执行过程中动态的实时时间。这与 [`NOW()`](now.md) 的行为不同,后者返回语句开始执行的时间。 | ||
|
||
## 函数语法 | ||
|
||
``` | ||
> SYSDATE(fsp) | ||
``` | ||
|
||
## 参数释义 | ||
|
||
| 参数 | 说明 | | ||
| ---- | ---- | | ||
| fsp | 非必要参数。如果给定 fsp 参数以指定从 0 到 6 的小数秒精度,则返回值包括该数字的小数秒部分。| | ||
|
||
## 示例 | ||
|
||
```sql | ||
mysql> select sysdate(); | ||
+----------------------------+ | ||
| sysdate() | | ||
+----------------------------+ | ||
| 2024-04-30 10:49:39.554807 | | ||
+----------------------------+ | ||
1 row in set (0.00 sec) | ||
|
||
mysql> select sysdate(6); | ||
+----------------------------+ | ||
| sysdate(6) | | ||
+----------------------------+ | ||
| 2024-04-30 10:50:08.452370 | | ||
+----------------------------+ | ||
1 row in set (0.00 sec) | ||
|
||
mysql> SELECT SYSDATE(), SLEEP(2), SYSDATE(); | ||
+----------------------------+----------+----------------------------+ | ||
| sysdate() | sleep(2) | sysdate() | | ||
+----------------------------+----------+----------------------------+ | ||
| 2024-04-30 10:50:30.004912 | 0 | 2024-04-30 10:50:32.005203 | | ||
+----------------------------+----------+----------------------------+ | ||
1 row in set (2.00 sec) | ||
|
||
mysql> SELECT NOW(), SLEEP(2), NOW(); | ||
+----------------------------+----------+----------------------------+ | ||
| now() | sleep(2) | now() | | ||
+----------------------------+----------+----------------------------+ | ||
| 2024-04-30 10:50:47.904309 | 0 | 2024-04-30 10:50:47.904309 | | ||
+----------------------------+----------+----------------------------+ | ||
1 row in set (2.00 sec) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters