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 extract date part from timestamp string in neo4j

Hello My issue is I want to get some nodes in fixed date between range of fixed time. I am importing nodes and relations from separate csv files .In relationship files there is a field name TIMESTAMP which contains string value. I have casted it in date time object.
my timestamp string looks like this -"2019-09-08T17:46:10Z" , I want to separate '2019-09-08' part from this string.
my so far done query is given bellow.

match ()-[r:wash|earns|owns]->(d)

with datetime(r.TIMESTAMP) as dateval,d,type(r) as transactiontype

where dateval.hour>=10 and dateval.hour<12

return dateval.hour,d.id,transactiontype

this query works fine for fixed range of hours. but I want to give another condition for fixed date like
where date ='2019-09-08' or something similar like that . I can't make it separate from my timestamp field. and can't fit this condition in my query. My data size is very large 7+ million and I am newbie in neo4j
How could I solve this.

2 REPLIES 2

WHERE dateval.year = 2019 AND dateval.month = 9 AND dateval.day = 8 AND dateval.hour>=10 AND dateval.hour<12

ameyasoft
Graph Maven

Using APOC:

RETURN apoc.date.format(apoc.date.parse("2019-09-08T17:46:10Z", 'ms', 'yyyy-MM-dd'), 'ms', 'yyyy-MM-dd')

Result: "2019-09-08"