我们如何向 Orient db 中的日期添加天数?
select sysdate()+1 from safetyplan;
它给出与 sysdate() 相同的输出。 1 没有被添加。你能帮帮我吗?
最佳答案
根据 Orientdb 文档 2.2:
sysdate() returns the current date time. If executed with no parameters, it returns a Date object, otherwise a string with the requested format/timezone.
因此,一种可能的方法是使用日期对象的 .asLong() 方法将日期对象转换为 long。然后进行必要的添加。使用 .asDate() 方法将其转换回日期。
示例:将一天添加到当前日期使用:
select sum(sysdate().asLong(),86400000).asDate() from safetyplan;
注意:我们以毫秒为单位加上1天=1000*60*60*24毫秒
注意:认为这个答案可能会对某人有所帮助,很抱歉回答我自己的问题。
关于sql - 如何在orientdb中添加天数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52713615/