Difference of two date time in sql server

后端 未结 20 1941
心在旅途
心在旅途 2020-12-01 03:53

Is there any way to take the difference between two datetime in sql server?

For example, my dates are

  1. 2010-01-22 15:29:55.090
相关标签:
20条回答
  • 2020-12-01 04:55

    PRINT DATEDIFF(second,'2010-01-22 15:29:55.090','2010-01-22 15:30:09.153')

    0 讨论(0)
  • 2020-12-01 04:55

    Please check below trick to find the date difference between two dates

     DATEDIFF(DAY,ordr.DocDate,RDR1.U_ProgDate) datedifff
    

    where you can change according your requirement as you want difference of days or month or year or time.

    0 讨论(0)
提交回复
热议问题