How to use DATEDIFF to return year, month and day?

后端 未结 9 937
离开以前
离开以前 2020-12-10 22:36

How can I use DATEDIFF to return the difference between two dates in years, months and days in SQL Server 2005

DATEDIFF (date , dat         


        
9条回答
  •  一个人的身影
    2020-12-10 23:22

    It works for some of the situations but when you are subtracting dates like 2007-10-15 (DateHired) from 2011-01-13 (dateterminated) it gives you a negative number when the abs isn't around it but putting the abs around doesn't fix it either because then the year and month figure are incorrect.

提交回复
热议问题