I am new to neo4j.FOr my project I have uploaded the data in ne04j.I have added created_time and modified_time as 2 property of the node.Now i want to build cypher query which would pull old those data which are modified 2 hr before.Can you share sample scirpt which would be helpful for me to fetch the data.
How did you store your dates? As date/time string, or did you use timestamp()? If you used timestamp, you could do something like this:
With (Timestamp()- 7200000) as newerthan
MATCH (n:label) where n.modified_time < newerthan
Return n
I did tried but it not working.Actually I had stored the time in datetime().So the above condition is not working.Can you suggest how can we fetch data which are last modified say 8 hr before from current time.
With (Timestamp()- 28800000) as olderthan
MATCH (n:Mynode) where datetime(n.modifiedtime).epochmillis < olderthan
return n
This will return nodes that were modified MORE THAN 8 hours prior to right now.
You may find it more convenient to store your timestamps converted to epoch, which makes it easier/faster to perform compare operations on them in your where clauses