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 convert a date format [mm/DD/yy] to [yyyy/MM/dd] using APOC or Cypher

Hi Guys,

I have a CSV file where the date format is [mm/DD/yy] (for example: 7/13/19, "July 13, 2019") and I want to upload to Neo4j using [yyyy/MM/dd] (2019/13/07). Are there any APOC procedures or Cypher queries that I can use to do this?

Thank you
Yamil

4 REPLIES 4

Sure, you can do a parse followed by a format with APOC:

WITH "07/13/19" as input
WITH apoc.date.parse(input, 'ms', 'MM/dd/yy') as ts
RETURN apoc.date.format(ts, 'ms', 'yyyy/MM/dd')

ameyasoft
Graph Maven

RETURN apoc.date.format(apoc.date.parse("July 13, 2019", 'ms', 'MMMM dd, yyyy'), 'ms', 'yyyy/MM/dd')

Result: "2019/07/13"

This was very helpful! Thank you so much!

Thank you guys the two answer are perfect. Both are really good solution.
Thank you so much