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

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?

Hello @DMF194 :slight_smile:

Replace MERGE by MATCH?

Regards,
Cobra

1 Like

@maxime.guery.contact Hi

Tried to replace the merge with the match already.

Still same error as stated above.

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")})