Skip to content

Commit

Permalink
Update 4.date-and-time.md (#981)
Browse files Browse the repository at this point in the history
  • Loading branch information
izhuxiaoqing authored Dec 21, 2021
1 parent 6ecb5d3 commit f5fac1f
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit f5fac1f

Please sign in to comment.