有什么简单的方法可以将 ISO Date 转换为密码中的 dd/mm/yyyy 格式?我尝试使用 "apoc.date.fromISO8601" 但它抛出了一个错误

is there any simple method to convert ISO Date to dd/mm/yyyy format in cypher? i tried using "apoc.date.fromISO8601" but its throwing up an error

我是 neo4j 的新手。我已经安装了 apoc 插件并更改了 neo4j.conf 文件 - 当我调用 apoc.help("date") 但当我尝试使用它时方法 apoc.date.fromISO8601 出现-它抛出一个错误

"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."

如果这不起作用,是否有更简单的方法将 ISO18601 日期转换为 dd/mm/yyyy 格式?

从 neo4j 3.1 开始,apoc.date.fromISO8601 是一个 函数 ,而不是 过程 。这意味着您可以像使用任何其他函数一样使用它(而不是使用 CALL 子句)。

例如,这个简单的查询:

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

returns:

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

同样,apoc.date.format 现在也是一个函数。以下是如何将 ISO8601 日期时间转换为 dd/mm/yyyy 格式的示例:

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

哪个returns:

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