apoc.date.fields
Syntax |
|
||
Description |
Splits the given date into fields returning a |
||
Arguments |
Name |
Type |
Description |
|
|
A string representation of a temporal value. |
|
|
|
The format the given temporal is formatted as. The default is: |
|
Returns |
|
Usage Examples
The The |
The following returns the fields of a date:
RETURN apoc.date.fields("2020-11-04", "YYYY-MM-dd") AS fields;
fields |
---|
{days: 4, zoneid: "UTC", months: 11} |
The following returns the fields of a datetime:
RETURN apoc.date.fields("2020-11-04T10:30:21", "YYYY-MM-dd'T'HH:mm:ss") AS fields;
fields |
---|
{hours: 10, seconds: 21, months: 11, minutes: 30, days: 4, zoneid: "UTC"} |
The following returns the fields of a datetime that contains a timezone:
RETURN apoc.date.fields("2020-11-04T10:30:21+01:00", "YYYY-MM-dd'T'HH:mm:ssz") AS fields;
fields |
---|
{hours: 10, seconds: 21, months: 11, minutes: 30, days: 4, zoneid: "+01:00"} |
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. |