DATEDIFF() 函数可以返回两个日期之间的天数。
如下:
SELECT DATEDIFF('2015-06-29','2015-06-12') AS DiffDate
结果得17
SELECT DATEDIFF('2015-06-12','2015-06-29') AS DiffDate
结果得-17
2023-01-08 09:22:42
DATEDIFF() 函数可以返回两个日期之间的天数。
如下:
SELECT DATEDIFF('2015-06-29','2015-06-12') AS DiffDate
结果得17
SELECT DATEDIFF('2015-06-12','2015-06-29') AS DiffDate
结果得-17