apoc.date.field
Function
apoc.date.field(time Long, unit String, timezone String)
- returns the value of one field from the given date time.
Signature
apoc.date.field(time :: INTEGER?, unit = d :: STRING?, timezone = UTC :: STRING?) :: (INTEGER?)
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 |
In version 3.4 Neo4j 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. |
Was this page helpful?