首页 > 解决方案 > 在查询中计算开始时间和结束时间之间的分钟差

问题描述

我是 Neo4j 社区的新手。所以我有以下问题:如何在查询中计算两个属性“开始时间”和“结束时间”(均为数据类型 DateTime)之间的分钟差?谢谢

标签: neo4jcypher

解决方案


你想要做的是计算 a Durationbetween two DateTime

为了做到这一点,durationNeo4j 中的函数duration.inSeconds会为您提供持续时间。然后你可以通过调用来获得分钟数.minutes

这是一个例子:

WITH datetime() AS now, datetime('2017-09-17T12:50:35.556+0100') AS date
RETURN duration.inSeconds(date, now).minutes

干杯


推荐阅读