How do I calculate difference in years and months given a start and end
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/6260372/calculate-years-months-weeks-and-days">Calculate Years, Months, weeks and Days</a>  </p>
</blockquote>



<p>How do I calculate difference in  years and months given a start and end date?</p>

<p>Hi</p>

<p>Working on a c# 2.0 project and I need to calculate the difference in years and months given the start and end date</p>

<p>I was thinking of a function like</p>

<pre><code>        public void CalculateYearsAndMonths(DateTime startDate,
                                            DateTime endDate,
                                            out int years,
                                            out int months)
        {
            int years=0;
            int months=0;

            //????
        }
</code></pre>

<p>any suggestions?</p>
