Given two DateTimes in C#, how can I display the difference in years and months?
I can do basic arithmatic on the timespan that comes from a simple subtraction but this won’t take into account the differing lengths of months, leap years etc.
Thanks for any help.
Because the underlying representation is measured in 100-nanosecond ticks since 12:00 midnight, January 1, 1 A.D., a subtraction will handle leap years etc. quite correctly: