Confusion over the second argument of the DATEDIFF function

Viewed 13028

I've referred to this on MSDN but I'm still unsure what the second argument in the DATEDIFF function is doing in the following two examples:

SELECT DATEDIFF(yy,0,getdate()) --run on 14 Aug this returns 112

SELECT DATEDIFF(yy,1000,getdate()) --I chose 1000 arbitrarily and run on 14 Aug this returns 110

Usually I'll use DATEDIFF to find the number of days, or number of years between two months and the second argument is then a date.

Reason I'd like to understand the above is to ultimately understand the following:

SELECT DATEADD(yy, DATEDIFF(yy,0,GETDATE()), 0)

3 Answers
Related