Skip to content

Commit

Permalink
Add the documentation for cypher date and datetime (#852)
Browse files Browse the repository at this point in the history
An introduction to the date() and datetime() functions in Cypher, along with the corresponding return formats of the date and datetime data types.
  • Loading branch information
zhangwh807 authored Feb 18, 2025
1 parent 6695221 commit b1ef694
Showing 1 changed file with 89 additions and 47 deletions.
136 changes: 89 additions & 47 deletions docs/zh-CN/source/8.query/1.cypher.md
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,18 @@ LIMIT toInteger(3 * rand())+ 1
CREATE (n:person {id:2002, name: 'Andres'})
RETURN n
```
- ✓ Return the date and datetime type attributes of the created node.

```
CREATE (n:person{id:1,name:"tom",t1:"2025-02-10",t2:"2025-02-10 02:35:30"})
RETURN n.t1 AS date,n.t2 AS datetime
```
**Example output:**

| date | datetime |
|--------------|-------------------------|
| 2025-02-10 | 2025-02-10 02:35:30 |


- Create relationships
- ✓ Create a relationship between two nodes
Expand Down Expand Up @@ -795,54 +807,56 @@ RETURN n.title AS name

### 3.1.Whole List Of Functions

| 种类 | 功能 | 备注 |
| ---------------------- |------------------| ------------------------- |
| Predicate functions | exists() | |
| | all() | 不支持 |
| | any() | 不支持 |
| | single() | 不支持 |
| | none() | 不支持 |
| Scalar functions | id() | |
| | euid() | |
| | properties() | |
| | head() | |
| | last() | |
| | toBoolean() | |
| | toFloat() | |
| | toInteger() | |
| | toString() | |
| | type() | |
| | startnode() | |
| | endnode() | |
| | size() | |
| | length() | |
| | substring() | |
| | concat() | |
| | label() | OpenCypher扩展方法 |
| Aggregating functions | avg() | |
| | collect() | |
| | count() | |
| | max() | |
| | min() | |
| | percentileCont() | |
| | percentileDisc() | |
| | stDev() | |
| | stDevP() | |
| | variance() | |
| | varianceP() | |
| | sum() | |
| List functions | keys() | |
| 种类 | 功能 | 备注 |
| ---------------------- |------------------|-----------------|
| Predicate functions | exists() | |
| | date() | |
| | datetime() | |
| | all() | 不支持 |
| | any() | 不支持 |
| | single() | 不支持 |
| | none() | 不支持 |
| Scalar functions | id() | |
| | euid() | |
| | properties() | |
| | head() | |
| | last() | |
| | toBoolean() | |
| | toFloat() | |
| | toInteger() | |
| | toString() | |
| | type() | |
| | startnode() | |
| | endnode() | |
| | size() | |
| | length() | |
| | substring() | |
| | concat() | |
| | label() | OpenCypher扩展方法 |
| Aggregating functions | avg() | |
| | collect() | |
| | count() | |
| | max() | |
| | min() | |
| | percentileCont() | |
| | percentileDisc() | |
| | stDev() | |
| | stDevP() | |
| | variance() | |
| | varianceP() | |
| | sum() | |
| List functions | keys() | |
| | labels() | 返回结果有且只有一个label |
| | nodes() | |
| | range() | |
| | subscript() | 不支持 |
| Mathematical functions | abs() | |
| | ceil() | |
| | floor() | |
| | rand() | |
| | round() | |
| | sign() | |
| String functions | / | |
| | nodes() | |
| | range() | |
| | subscript() | 不支持 |
| Mathematical functions | abs() | |
| | ceil() | |
| | floor() | |
| | rand() | |
| | round() | |
| | sign() | |
| String functions | / | |

### 3.2.Predicate functions

Expand All @@ -863,6 +877,34 @@ RETURN n.name, n.born
| ------------ |
| true |

- date()

The date class handles dates (year, month, day) without including time.

```
RETURN date() AS date
```

**Example output:**

| date |
|--------------|
| 2025-02-10 |

- datetime()

The datetime class handles both dates and times, including hours, minutes, and seconds, with precision up to nanoseconds.

```
RETURN datetime() AS datetime
```

**Example output:**

| datetime |
|---------------------------------|
| 2025-02-10 02:35:30.095486000 |

### 3.3.Scalar functions

- id()
Expand Down

0 comments on commit b1ef694

Please sign in to comment.