SQLite中计算当前日期跟某个日期相差的天数
--(1)日期
SELECT DATE();
SELECT DATETIME();
SELECT JULIANDAY('now');
SELECT JULIANDAY(DATE());
SELECT JULIANDAY(DATE())-JULIANDAY('2022-12-15');
SELECT JULIANDAY('now');
SELECT JULIANDAY(DATE());这两句是一样的效果
最终直接整合到SQL语句中去
select JULIANDAY(DATE())-JULIANDAY(min(date)) as betweenDays from PayInfo where IFNULL(direction,'')<>''
运行效果如下: