Calculate the number of days between the current date and a certain date in SQLite

Calculate the number of days between the current date and a certain date in 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());

These two sentences have the same effect

Finally, it is directly integrated into the SQL statement

select JULIANDAY(DATE())-JULIANDAY(min(date)) as betweenDays from PayInfo where IFNULL(direction,'')<>'' 

The running effect is as follows:

 

Guess you like

Origin blog.csdn.net/wh445306/article/details/130647502