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 fetch the data which is 2 hr old

Dear All,

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.

5 REPLIES 5

pdrangeid
Graph Voyager

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

Couldn't test this, as I'm on my mobile right now

Hi Paul,

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

I had stored the date in timestamp format.Thanks for suggestion Let me test confirm.

Thanks

Thanks for the solution Paul.