cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to change string in to datetime type?

when i import CSV file into neo4j browser,there is a row called CreationDate. it has a different type of date format. so i use python to convert them into the same format. the python code is below:

2X_1_171a7b7f9a905bba146f5a92c05028a830b3969b.png

however, i want this CreationDate data can be calculate in the neo4j, so when i import the final file into neo4j, use DateTime type but there always errors:

2X_2_2877efd2740d4f2c7bd110a2eca8e20d7f59ec29.png

how can i change string type into DateTime type?
or how can i import appropriate format so that i can calculate easily

2 REPLIES 2

You don't need the brackets around {row.CreationDate}, as Cypher is interpreting this as a map literal, or as parameter access. Just use row.CreationDate without brackets.

What's worked for me is this:

datetime({epochMillis:apoc.date.parse(row['end date'],'ms', 'dd/MM/yyyy')})

Using a combination of the datetime() function and the apoc.date.parse() function.