I am trying to calculate the number of months between two dates in c#.
I have two dates in a c# string.
At first i was calculating Mat.Abs(DateTime.Parse(txtStartDt.Value).Month - DateTime.Parse(txtEndDt.Value).Month))+ 1
Then i realized that i may have values where the years differ eg. 2007 - 2009 the code i have above doesnt account for that.
What would be the best solution/algorithm to get the correct number of months from two dates?