Neo4j Cypher comparing dates in Cypher query
<p>Right now I'm designing a system with Neo4j database where I have to be able to have a query check if a <code>Date</code> property in a node is before, equal or after the provided <code>Date</code>.</p>

<p>How should I store the <code>Date</code> inside of Neo4j Node property to be able to do a comparison with Cypher query based for example on simple operators like <code>==</code>, <code>&gt;</code>, <code>&lt;</code></p>

<p>Is it okay to store <code>Date</code> like <code>Long timestamp</code>? Will it work this way ? If no, please suggest a better decision.</p>

<p><strong>UPDATED</strong></p>

<p>Queries I have tried with no luck:</p>

<pre><code>MATCH (parentD)-[:CONTAINS]-&gt;(childD:Decision)-[ru:CREATED_BY]-&gt;(u:User) WHERE id(parentD) = {decisionId}  MATCH (childD)&lt;-[:SET_FOR]-(filterValue153:Value)-[:SET_ON]-&gt;(filterCharacteristic153:Characteristic) WHERE id(filterCharacteristic153) = 153 WITH filterValue153, childD, ru, u WHERE  (filterValue153.value = '60305027689736') 

MATCH (parentD)-[:CONTAINS]-&gt;(childD:Decision)-[ru:CREATED_BY]-&gt;(u:User) WHERE id(parentD) = {decisionId}  MATCH (childD)&lt;-[:SET_FOR]-(filterValue153:Value)-[:SET_ON]-&gt;(filterCharacteristic153:Characteristic) WHERE id(filterCharacteristic153) = 153 WITH filterValue153, childD, ru, u WHERE  (filterValue153.value = 'Mon Dec 27 22:35:56 EET 3880') 
</code></pre>

<p>Where <code>filterValue153.value</code> has been stored like <code>java.util.Date</code> object in <code>Value.value</code> node property</p>

<pre><code>@NodeEntity
public class Value extends Authorable {

    public final static String NODE_NAME = "Value";

    private final static String SET_FOR = "SET_FOR";
    private final static String SET_ON = "SET_ON";

    @Relationship(type = SET_FOR, direction = Relationship.OUTGOING)
    private Decision decision;

    @Relationship(type = SET_ON, direction = Relationship.OUTGOING)
    private Characteristic characteristic;

    private Object value;

...

}
</code></pre>

<p>at database level for <code>Value</code> node I have a following data:</p>

<pre><code>id: 848013
value:  1482873001556
</code></pre>

<p><strong>UPDATED</strong></p>

<p>This query works fine</p>

<pre><code>MATCH (parentD)-[:CONTAINS]-&gt;(childD:Decision)-[ru:CREATED_BY]-&gt;(u:User) WHERE id(parentD) = {decisionId}  MATCH (childD)&lt;-[:SET_FOR]-(filterValue153:Value)-[:SET_ON]-&gt;(filterCharacteristic153:Characteristic) WHERE id(filterCharacteristic153) = 153 WITH filterValue153, childD, ru, u WHERE  (filterValue153.value = 60305030539682) 
</code></pre>

<p>but how to deal with dates prior January 1, 1970, 00:00:00 GMT ? 
Also is it okay to apply <code>=</code>, <code>&gt;</code>, <code>&lt;</code> operations in this Cypher query on dates ?</p>