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,'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?


1 Like

@Cobra Hi

Tried to replace the merge with the match already.

Still same error as stated above.

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