Subtract two dates in SQL and get days of the result

后端 未结 6 1771
你的背包
你的背包 2021-01-01 09:11
Select I.Fee
From Item I
WHERE GETDATE() - I.DateCreated < 365 days

How can I subtract two days? Result should be days. Ex: 365 days. 500 days..

6条回答
  •  天命终不由人
    2021-01-01 09:19

    SELECT DATEDIFF(day,'2014-06-05','2014-08-05') AS DiffDate
    

    diffdate is column name.

    result:

    DiffDate

    23

提交回复
热议问题