cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

Changing and updating the key values from string datetime to datetime format

DMF194
Node Clone

Hi everyone,

This is my first time using the APOC package in neo4j.

I am trying to convert the values of my property key from string format to datetime format( eg, "2021/03/06 13:05:45.7" -> 2021/03/06T13:05:45.7

//change string datetime to object datetime
merge (p:POSITIONS)
with p.time as d
where d is not null
with apoc.date.parsed(d,'ms',"yyyy-MM-dd' 'HH:mm:ss") as r
set r= datetime({epochmillis:r})

But the error I get is

variable 'p' is not defined

Anyone have any suggestions?

3 REPLIES 3

Cobra
Ninja
Ninja

Hello @DMF194

Replace MERGE by MATCH?

Regards,
Cobra

@Cobra Hi

Tried to replace the merge with the match already.

Still same error as stated above.

Cobra
Ninja
Ninja
MATCH (p:POSITIONS)
SET (CASE WHEN p.time IS NOT NULL THEN p END).time = datetime({epochmillis: apoc.date.parse(p.time, "ms", "yyyy-MM-dd HH:mm:ss")})