0
votes

I'm new to neo4j. I've installed the apoc plugin and changed the neo4j.conf file - the method apoc.date.fromISO8601 shows up when I call apoc.help("date") but when I try using it -it throws an error

"Neo.ClientError.Procedure.ProcedureNotFound: There is no procedure with the name apoc.date.format registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed."

If this doesn't work is there a simpler way to convert ISO18601 dates to dd/mm/yyyy format?

1

1 Answers

1
votes

Starting with neo4j 3.1, apoc.date.fromISO8601 is a function, not a procedure. This means you can use it like any other function (and not use aCALL clause).

For example, this simple query:

RETURN apoc.date.fromISO8601('2019-04-03T00:00:00.000Z');

returns:

╒═══════════════════════════════════════════════════╕
│"apoc.date.fromISO8601('2019-04-03T00:00:00.000Z')"│
╞═══════════════════════════════════════════════════╡
│1554249600000                                      │
└───────────────────────────────────────────────────┘

Similarly, apoc.date.format is now a function as well. Here is an example of how to convert an ISO8601 datetime into dd/mm/yyyy format:

RETURN apoc.date.format(
  apoc.date.fromISO8601('2019-04-03T00:00:00.000Z'),
  "ms",
  "dd/MM/yyyy")

which returns:

╒══════════════════════════════════════════════════════════════════════╕
│"apoc.date.format(apoc.date.fromISO8601('2019-04-03T00:00:00.000Z'), "│
│ms", "dd/MM/yyyy")"                                                   │
╞══════════════════════════════════════════════════════════════════════╡
│"03/04/2019"                                                          │
└──────────────────────────────────────────────────────────────────────┘