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

User guide for using date and datetime in the Cypher documentation #849

Closed
wants to merge 1 commit into from
Closed
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
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
Loading