apoc.date.field
Syntax |
|
||
Description |
Returns the value of one field from the given date time. |
||
Arguments |
Name |
Type |
Description |
|
|
The timestamp in ms since epoch to return a field from. |
|
|
|
The unit of the field to return the value of. The default is: |
|
|
|
The timezone the given timestamp is in. The default is: |
|
Returns |
|
Usage Examples
The
The computed value will be in the unit specified by the |
The following returns the hours of a datetime:
WITH datetime("2020-11-04T10:30:00").epochMillis AS datetime
RETURN apoc.date.field(datetime, "hours") AS hour;
hour |
---|
10 |
The following returns the weekday of a datetime:
WITH datetime("2020-11-04T10:30:00").epochMillis AS datetime
RETURN apoc.date.field(datetime, "weekday") AS weekday;
weekday |
---|
3 |
Neo4j 3.4 introduced temporal data types, which are the recommended way of representing dates in Neo4j.
Fields of a temporal type can be retrieved using Cypher’s If, however, you still need to convert timestamp formats, this procedure provides that functionality. |