Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update using time string in timestamp function #1383

Merged
merged 3 commits into from
Jan 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions docs-2.0/3.ngql-guide/3.data-types/4.date-and-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,28 @@
- 插入`TIMESTAMP`的方式包括时间戳、`timestamp()`函数和`now()`函数。

- `timestamp()`函数支持传入空值获取当前时区的时间戳,还接受 string 类型的参数。

```ngql
# 传入当前时间。
nebula> RETURN timestamp();
+-------------+
| timestamp() |
+-------------+
| 1625469277 |
+-------------+

# 传入指定时间。
nebula> RETURN timestamp("2021-07-05T06:18:43.984000");
+-----------------------------------------+
| timestamp("2021-07-05T06:18:43.984000") |
+-----------------------------------------+
| 1625465923 |
+-----------------------------------------+
```

```ngql
# 传入当前时间。
nebula> RETURN timestamp();
+-------------+
| timestamp() |
+-------------+
| 1625469277 |
+-------------+

# 传入指定时间。
nebula> RETURN timestamp("2022-01-05T06:18:43");
+----------------------------------+
| timestamp("2022-01-05T06:18:43") |
+----------------------------------+
| 1641363523 |
+----------------------------------+
```

!!! compatibility "历史版本兼容性"

在 Nebula Graph 3.0.0 版本前,传入 timestamp() 函数的时间字符串可包含毫秒和微秒;从 3.0.0 版本起,传入 timestamp() 函数的时间字符串不支持包含毫秒和微秒。

- 底层存储的数据格式为** 64 位 int**。

Expand Down