nmkkannan
nmkkannan

Reputation: 1303

Neo4j - Date conversion

I'm using Neo4j database.Neo4j does not have date data type only have timestamp data type.

I need to compare current date with existing date using cql query.

My existing date format is "8/4/2011" that is string.

Then how can I compare it.Any way to use stored procedure [date] while csv bulk data import time.

I used APOC stored procedure but I don't know how compare it.

CALL apoc.date.format(timestamp(),"ms","dd.MM.yyyy")
07.07.2016

CALL apoc.date.parse("13.01.1975 19:00","s","dd.MM.yyyy HH:mm")
158871600

I expect like this

MATCH(dst:Distributor) WHERE dst.DIST_ID = "111137401" WITH dst CALL apoc.date.parse(dst.ENTRY_DATE,'s', 'dd/MM/yyyy') YIELD d SET  dst.ENTRY_DATE = d RETURN dst;

Any possibilities please help me...

Upvotes: 3

Views: 5884

Answers (2)

Jobin Mathew
Jobin Mathew

Reputation: 483

RETURN datetime("2018-06-04T10:58:30.007Z").epochMillis

1528109910007

Upvotes: 2

nmkkannan
nmkkannan

Reputation: 1303

Right query is :

USING PERIODIC COMMIT LOAD CSV WITH HEADERS FROM "file:///DST.csv" AS row
CALL apoc.date.parse(toString(row.ENTRY_DATE),"ms","dd-MMM-yy") YIELD value as date CREATE (DST:Distributor {ENTRY_DATE: date })

Upvotes: 0

Related Questions