I need to get the difference in months between two dates.
In SQL, this is what I need:
select DATEDIFF(MONTH, '11/1/2014', DATEADD(mm, DATEDIFF(mm, 0, '12/31/2014') + 1, 0))
The above date difference should be 2 months.
Difference between 12/10/2014 and 12/20/2014 = 1 month.
Difference between 11/1/2012 and 12/31/2014 = 26 months.
How do I do the same in C#?