neo4j - 在neo4j中添加时间戳

标签 neo4j cypher

我正在寻找使用 Neo4j 中的时间戳(长值)的范围之间的出生日期。 这里我匹配用户,id 为 10662 。与其他用户一样,date_birth 的范围在 u.date_birth 的 +3 到 -3 年之间

10800000 的值是以毫秒为单位的 3 年,但我没有得到任何结果,我确信出了什么问题。但无法定位问题所在。

如果有任何帮助,我将不胜感激。

match (u:user {id : "10662"})-[r:has_profile]->(p:profile)  , (u2:user)-[r2:has_profile]->(p2:profile)  where  p.user_id <> p2.user_id  and u2.date_birth >= u.date_birth -toInt(10800000) and u2.date_birth <= u.date_birth + toInt(10800000)  return collect (u2.id) as id;

最佳答案

3 年以毫秒为单位(假设每年 365 天)实际上是 94608000000。

这对你有用吗?

MATCH (u:user {id : "10662"})-[r:has_profile]->(p:profile), (u2:user)-[r2:has_profile]->(p2:profile)
WHERE
  p.user_id <> p2.user_id AND
  abs(u2.date_birth - u.date_birth) >= 94608000000
RETURN collect(u2.id) as id;

关于neo4j - 在neo4j中添加时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31344450/

相关文章:

algorithm - 在 Neo4j 中查找通过给定节点的所有简单循环

Neo4j:在 Cypher 中使用 Log 函数

python - py2neo 是否通过 REST API 访问 Neo4j 中的所有数据类型字符串?

python - 如何使用 py2neo 声明唯一约束

database - Neo4j 和算法

java - 如何在 neo4j 中不保留逻辑日志?

node.js - graphenedb 中的自动索引

Neo4j/Cypher 删除有关系的节点和子节点

java - Neo4j Cypher 查询极慢(约 20 分钟)

java - 使用通配符进行 Neo4j 标签索引搜索