I am using neo4j-admin import tool to import data from large csv files. These files are exported from SQL Server.
The problem that I am facing is different format between SQL and Neo4j:
In SQL Server, datetime field is: 2018-08-16 01:15:34.500
When I import data, it has an error: Text cannot be parsed to a DateTime
Because using neo4j import tool, I cannot use any apoc or something like that to reformat this string
How can I solve this ? (I am using Neo4j community 3.4.7)
Thanks in advance.
The issue seems to be the space between the date and the time. Replacing the space for "T" fixed the issue for me.
MATCH(n:Node) RETURN datetime( REPLACE(n.DateTime," ","T"))
Thanks, found this really helpful. Not sure if anyone else had the same issue, but I found replacing the space with a "T" imports this column as a string, not a datetime type. Therefore it still needs to be converted into a datetime series after.
Try this:
with "2018-08-16 01:15:34.500" as dte
RETURN apoc.date.format(apoc.date.parse(dte, 'ms', 'yyyy-MM-dd'), 'ms', 'yyyy-MM-dd')
result:
"2018-08-16"
During import from csv file replace 'dte' with date column say row.date.