title: Find all quarters between 2 dates
body: <p>I'm trying to find all quarters between 2 given dates. </p>
  
  <p>For example if the current date is today(15 Jan 2013) and a date in the past is 01 Jan 2012, I should be getting the following result:
  Dec 2012
  Sep 2012
  June 2012
  March 2012</p>
  
  <p>I can kind of keep deducting 3 months from the current date, but that is not going to be accurate as the test below denotes:</p>
  
  <pre><code>  [TestMethod]
          public void FindAllQuaters_FromAGivenDate_TillAPastDate()
          {
              var dateFinder = new FindQuarter();
              //Between Feb 2013 &amp; Jan 2012
              var dates = dateFinder.GetAllQuarters(new DateTime(2013, 02, 01), new DateTime(2012, 01, 01)).ToList();
  
              Assert.IsTrue(dates.Count == 4);
              Assert.IsTrue(dates.First().Month == 12);
              Assert.IsTrue(dates.First().Year == 2012);
  
              Assert.IsTrue(dates.Skip(1).First().Month == 9);
              Assert.IsTrue(dates.Skip(1).First().Year == 2012);
  
              Assert.IsTrue(dates.Skip(2).First().Month == 6);
              Assert.IsTrue(dates.Skip(2).First().Year == 2012);
  
              Assert.IsTrue(dates.Skip(3).First().Month == 3);
              Assert.IsTrue(dates.Skip(3).First().Year == 2012);
          }
      }
  
      public class FindQuarter
      {
          public IEnumerable&lt;DateTime&gt; GetAllQuarters(DateTime current, DateTime past)
          {
              while (current &gt; past)
              {
                  current = current.AddMonths(-3);
                  yield return current;
              }
          }
      }
  </code></pre>
  
  <p>How can I achieve this? The quarters are defined as March,June,September &amp; December. I would also need the last date of that month(which I hope would be quick).</p>
  
  <p>EDIT: This is not working because it keeps deducting 3 months from a given date, for example if the current date is feb 2013 and I reduce 3 months,I get Nov 2012 and not December 2012.</p>
  
  <ul>
  <li><p>Any dates in Jan,Feb,March will belong to first quarter i.e March</p></li>
  <li><p>Any dates in April,May,June will belong to second quarter i.e June</p></li>
  <li><p>Any dates in July,Aug,Sep will belong to third quarter i.e September</p></li>
  <li><p>Any dates in Oct,Nov,Dec will belong to fourth quarter i.e December</p></li>
  </ul>