History attribute in neo4j

I was reading about time-based versions of plots and came across the following example:

CREATE (s1:Shop{shop_id:1})
  -[:STATE{from:1388534400000,to:9223372036854775807}]->
  (ss1:ShopState{name:'General Store'})

      

My question is, how do I calculate this date? from:1388534400000,to:9223372036854775807

+3


source to share


2 answers


These two values ​​are timestamps, which in java are milliseconds since Epoch started (1/1/1970). The second value is the maximum long value, end of Java time, far away.

There are ways in all languages ​​to generate these values ​​for specific dates (beware some of them are based on seconds), there is a fairly handy list on this site .

If you are not working in any particular programming language and just want to enter queries, you can use an online date converter like this one .



You can also calculate timestamps in Cypher if you are working with dates that are related in Now

some way using a function timestamp()

:

CREATE (s1:Shop{shop_id:1})
-[:STATE{from:timestamp(),to:9223372036854775807}]->
(ss1:ShopState{name:'General Store'})

      

+2


source


IIUC to

is simple Long.MAX_VALUE

, and from

can be the result of either calling a function timestamp()

through Cypher or setting a property with a value System.currentTimeMills()

through the Java API.



Take a look at an example: http://console.neo4j.org/?id=43uoyt (note that you can skip the setting rel.to

and use coalesce

when prompted instead).

+2


source







All Articles