Skip to content

Commit

Permalink
bison datetime parser (#1330)
Browse files Browse the repository at this point in the history
  • Loading branch information
cooper-lzy committed Dec 17, 2021
1 parent 3112441 commit 2c79294
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,14 +12,18 @@

- 函数`date()``time()``datetime()`可以用属性名称获取自身的某一个具体属性值,例如`date().month`获取当前月份、`time("02:59:40").minute`获取传入时间的分钟数。

- 函数`date()``time()``datetime()`可以指定时区进行转换,例如`datetime("2017-03-04 22:30:40.003000+08:00")``datetime("2017-03-04T22:30:40.003000[Asia/Shanghai]")`

## openCypher 兼容性

- 支持年、月、日、时、分、秒,不支持毫秒
- 支持年、月、日、时、分、秒、毫秒、微秒,不支持纳秒

- 不支持函数`localdatetime()``duration()`

- 不支持大部分字符串时间格式,支持`YYYY-MM-DDThh:mm:ss``YYYY-MM-DD hh:mm:ss`

- 支持单个数字的字符串时间格式,例如`time("1:1:1")`

## DATE

`DATE`包含日期,但是不包含时间。Nebula Graph 检索和显示`DATE`的格式为`YYYY-MM-DD`。支持的范围是`-32768-01-01``32767-12-31`
Expand Down Expand Up @@ -83,7 +87,7 @@
2. 插入点,名称为`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. 获取`test1`的属性`p1`的月份。
Expand Down

0 comments on commit 2c79294

Please sign in to comment.