我正在寻找使用 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/