Hi,

> I have dates in Neo4j stored as JSON Dates.
> 
> e.g.
> DateCreated: "/Date(1310360656147+0000)/"
> 
> LastLogin: "/Date(1311927251851+0000)/"
> 
> I use the iterator and lambda way of query data
> 
> e.g.
> g.v(0).outE[[label:'HOSTS']].inV{it.'Name'.compareTo('Agency1') == 0}.Name


SIDENOTE: g.v(0).out('HOSTS'){ .... } is a more concise and speedier 
representation.


> However I want to compare dates, what is the format we can use for this? 
> Currently we have written a .Net client to consume Neo4J and I we have a 
> formatter in the client api that converts c# lambda's to java lambda's, so it 
> would be nice to know the best way to do date comparisons :)
> 
> e.g.
> g.v(0).outE[[label:'HOSTS']].inV{it.'LastLogin'.dateCompareTo('/Date(1311927251851+0000)/')
>  == 0}.Name

Huh. I would use Java/Groovy Date object. ? ...

        http://www.cafeaulait.org/course/week4/68.html

        DateFormat formatter = new SimpleDateFormat("yyyyMMdd");
        Date rootDate = formatter.parse(dateString);

Thus, something like:

        g.v(0).out('HOSTS'){formatter.parse(it.LastLogin).after(rootDate)}.Name

HTH,
Marko.

http://markorodriguez.com

_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to