.NET gives you the “correct” answer - noting that the “correct” one assumes a purely Gregorian calendar, as Andrew Whitaker points out in the comments below and answers above. Andrew answer is more correct.
A leap year can be defined as divisible by 4 but not divisible by 100 if it is not divisible by 400. Therefore, starting on 1/1/0001 after these rules, there were 488 leap days.
Accounting for these leap days amounted to 735 598 days from 1/1/0001 to the end of 2014. This leaves us with day No. 170 of 2015, which is 6/20/2015 (31 + 28 + 31 + 30 + 31 + 20).
Also, this is not a rounding issue in .NET, as some have suggested. Since DateTime.AddDays uses ticks, which are long data types in the form of 64-bit signed ints, no overflow or rounding occurs.
Ticks/day = 864BB (or 8.64 x 10^11) Tick / (2,015 years) ~ 1.75 x 10^15 Max long = 9,223,372,036,854,775,807 (or 9.22 x 10^18)
source share