[英]Getting DateTime difference in OrientDB
I have the following Carts table schema of orientDB. 我有以下CartDB表架构的orientDB。 All I wanted to do is to select those records where
我想做的就是选择那些记录
(CurrentTime - timeStamp) >= expiration
I had also tried to achive my goal thorugh converting to unix timestamp and tried following queries 我还试图实现我的目标,转换为unix时间戳并尝试以下查询
SELECT * FROM Carts WHERE eval("('+new Date().getTime()+' timeStamp.asLong())/1000") >= expiration
And also by following technique but when :parameter is passed in eval funtion it convert it into '?' 并且通过遵循技术,但是当:参数在eval函数中传递时,它将其转换为'?' and don't return required data.
并且不返回所需的数据。
db.query(
'SELECT eval("'+new Date().getTime()+' - timeStamp.asLong()") as DIFF, :nowTimeStamp as NOW, timeStamp.asLong() as THEN FROM Carts ',
{
params: {
nowTimeStamp: new Date().getTime()
}
}).then(callback);
Try this query: 试试这个查询:
SELECT * FROM Carts WHERE eval("SYSDATE().asLong() / 1000 - timeStamp.asLong() / 1000") >= expiration
Hope it helps. 希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.