Manish Nakar
Manish Nakar

Reputation: 4636

how to find 30 days old records in neo4j using cypher query

I have been using mysql where I can find 30 days old records using sql query and date function. I want to build a similar functionality on neo4j. But I am not able to find date functions in cypher.

mysql> select  DATE_SUB(NOW(),INTERVAL 30 DAY);
+---------------------------------+
| DATE_SUB(NOW(),INTERVAL 30 DAY) |
+---------------------------------+
| 2015-06-27 01:51:47             |
+---------------------------------+

Upvotes: 0

Views: 655

Answers (1)

Michael Hunger
Michael Hunger

Reputation: 41706

Right now there are no date functions.

You'd store the date as long or comparable string.

For just any date-range you can do comparisons (but it won't be that fast).

WHERE n.date < '2015-05-15' AND n.date > '2014-12-31'

So for faster range queries either wait for Neo4j 2.3-RC01 or use an in graph date structure like a linked list (of days) with attached entities or a time-tree.

See:

Upvotes: 1

Related Questions