How to Calculate the Difference in Months Between two Dates C#

This code snippet lets you calculate the difference in months between two dates. If all you want is simply a difference in the months -completely disregarding the date values- then you can use this: public static int MonthDifference(this DateTime lValue, DateTime rValue) { return (lValue.Month – rValue.Month) + 12 * (lValue.Year – rValue.Year); } Note […]

Read More