Calculate month between two date

DateTime d1 = new DateTime(2002, 1, 1);  

DateTime d2 = new DateTime(2000, 10, 1);  

int M = Math.Abs((d1.Year - d2.Year));  

int months = ((M * 12) + Math.Abs((d1.Month - d2.Month)));
Next Recommended Reading Keeping up to date