Home > database >  Calculate the time difference two fields
Calculate the time difference two fields

Time:09-16

Calculate delivery overdue days, storage should be the delivery date time field reduced the field how to write a SQL statement

CodePudding user response:

 


Select datediff (day, '2020/03/02', '2020/03/03')

CodePudding user response:

Table A
Customers should be overdue days of delivery date warehouse date
Customer 1 l 3/5 3
Customer 2
Customer 3
.
.
.
Is such a form, statistics according to the way you said not to come out, I suggest is, I'm sorry, load, failure reason: from a string when converting date and/or time, conversion failure

CodePudding user response:

SELECT DATEDIFF (DAY, CAST (' 2020/'+ warehouse DATE AS the DATE), CAST (' 2020/' should be the delivery DATE AS the DATE +))
FROM the TABLE

CodePudding user response:

To calculate two date time difference, please refer to the article
  • Related