DATEDIFF SQL function counts the number of times you pass the border specified as units, whereas the .NET DateTime.Subtract() function (you use this function if you implicitly use the minus operator) returns the actual TimeSpan between two dates, so you should see differences between the two results.
Example
The following query will return 1:
SELECT DATEDIFF(day, '1/1/2015 23:58:00', '1/2/2015 00:02:00')
The difference between the two dates is only 4 minutes, but since the border between the two dates (at 12:00 midnight) has passed, it returns 1. The same two dates will return a TimeSpan of 4 minutes in C #. If you check only the Days (not TotalDays ) part of this TimeSpan (as you do above), you will get 0.
source share