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"│
CodePudding user response:
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