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 4.date-and-time.md #981

Merged
merged 1 commit into from
Dec 21, 2021
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
8 changes: 6 additions & 2 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 @@ -12,16 +12,20 @@ While inserting time-type property values, except for `TIMESTAMP`, Nebula Graph

- `date()`, `time()`, and `datetime()` all accept the property name to return a specific property value of itself. For example, `date().month` returns the current month, while `time("02:59:40").minute` returns the minutes of the importing time.

- `date()`, `time()`, and `datetime()` can transform a time-type property with a specified time zone. For example, `datetime("2017-03-04 22:30:40.003000+08:00")` or `datetime("2017-03-04T22:30:40.003000[Asia/Shanghai]")`.

## OpenCypher Compatibility

In nGQL:

- Year, month, day, hour, minute, and second are supported, while the millisecond is not supported.
- Year, month, day, hour, minute, second, millisecond, and microsecond are supported, while the nanosecond is not supported.

- `localdatetime()` and `duration()` are not supported.

- Most string time formats are not supported. The exceptions are `YYYY-MM-DDThh:mm:ss` and `YYYY-MM-DD hh:mm:ss`.

- The single-digit string time format is supported. For example, `time("1:1:1")`.

## DATE

The `DATE` type is used for values with a date part but no time part. Nebula Graph retrieves and displays `DATE` values in the `YYYY-MM-DD` format. The supported range is `-32768-01-01` to `32767-12-31`.
Expand Down Expand Up @@ -84,7 +88,7 @@ The `TIMESTAMP` data type is used for values that contain both date and time par
2. Insert a vertex named `test1`.

```ngql
nebula> INSERT VERTEX date1(p1, p2, p3) VALUES "test1":(date("2021-03-17"), time("17:53:59"), datetime("2021-03-17T17:53:59"));
nebula> INSERT VERTEX date1(p1, p2, p3) VALUES "test1":(date("2021-03-17"), time("17:53:59"), datetime("2017-03-04T22:30:40.003000[Asia/Shanghai]"));
```

3. Return the content of the property `p1` on `test1`.
Expand Down