Neo4J DateTime错误的翻译为1970

发布于 2025-01-26 16:31:47 字数 1419 浏览 5 评论 0 原文

我的节点与DateTime有关,在使用转换为: https://community.neo4j.com/t/cannot-construct-date time-from-no-value-failure-when-processing-file/34973/4

我遇到了1970年的误解。帮助查找此查询有什么问题?

MATCH (n:Resource) 
with n, datetime({epochmillis: toInteger(n.created_at)}) as time
return n.created_at, toInteger(n.created_at), time

时间列没有意义,应该在2022年。 https://www.epochconverter.com/

得到了此结果:

"n.created_at"   │"toInteger(n.created_at)"│"time"                          │
╞═════════════════╪═════════════════════════╪════════════════════════════════╡
│1651750310.706613│1651750310               │"1970-01-20T02:49:10.310000000Z"│
├─────────────────┼─────────────────────────┼────────────────────────────────┤
│1651750359.453425│1651750359               │"1970-01-20T02:49:10.359000000Z"│
├─────────────────┼─────────────────────────┼────────────────────────────────┤
│1651751391.714048│1651751391               │"1970-01-20T02:49:11.391000000Z"│

I have nodes with datetime and when using conversion as:
https://community.neo4j.com/t/cannot-construct-date-time-from-no-value-failure-when-processing-file/34973/3
https://community.neo4j.com/t/cannot-construct-date-time-from-no-value-failure-when-processing-file/34973/4

I got wrong dates to 1970. Can you help find what is wrong with this query ?

MATCH (n:Resource) 
with n, datetime({epochmillis: toInteger(n.created_at)}) as time
return n.created_at, toInteger(n.created_at), time

Results of time column does not make sense, they should be in 2022.
https://www.epochconverter.com/

Got this result:

"n.created_at"   │"toInteger(n.created_at)"│"time"                          │
╞═════════════════╪═════════════════════════╪════════════════════════════════╡
│1651750310.706613│1651750310               │"1970-01-20T02:49:10.310000000Z"│
├─────────────────┼─────────────────────────┼────────────────────────────────┤
│1651750359.453425│1651750359               │"1970-01-20T02:49:10.359000000Z"│
├─────────────────┼─────────────────────────┼────────────────────────────────┤
│1651751391.714048│1651751391               │"1970-01-20T02:49:11.391000000Z"│

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红尘作伴 2025-02-02 16:31:47

您正在使用 epochmillis ,希望以毫秒为单位,但您的 create_at 在几秒钟内。只需将其乘以1000,然后插入 Epochmillis

You are using epochmillis which expect to get the timestamp in milliseconds, but your created_at is in seconds. Just multiply it by 1000 before inserting to epochmillis

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文