自己試看看結果.
<pre class="c" name="code">
        static void Main(string[] args)
        {
            DateTime t1 = DateTime.Parse("2012/11/30");
            DateTime t2 = t1.AddMonths(3);  //加3個月
            Console.WriteLine("{0}", t2);   // 2013/2/28
            Console.ReadKey();
        }
稍微修改上面的CODE
<pre class="c" name="code">
        static void Main(string[] args)
        {
            DateTime t1 = DateTime.Parse("2012/11/30");
            for (int i = 1; i <= 240; i++)
            {
                int addMonths = 3 * i;
                //判斷建資料日期是否大於每隔三個月的那個月裏的天數,若是則以當月最後一天為主、否則已建立的日期為主。
                if (t1.Day > DateTime.DaysInMonth(t1.AddMonths(addMonths).Year, t1.AddMonths(addMonths).Month))
                {
                    Console.WriteLine(t1.AddMonths(addMonths).Year + "/" + t1.AddMonths(addMonths).Month + "/" + DateTime.DaysInMonth(t1.AddMonths(addMonths).Year, t1.AddMonths(addMonths).Month));
                }
                else
                {
                    Console.WriteLine(t1.AddMonths(addMonths).Year + "/" + t1.AddMonths(addMonths).Month + "/" + t1.AddMonths(addMonths).Day);
                }
            }
            Console.ReadKey();
        }
如果需求是每3個月,ycl8000 的範例就是正確的,而且簡單。
如果是指定3個月後的某一天,則 lemoncar 算是正確的,但不夠清楚。