Adds a specified number of months to the current DateTimeOffset object.
using System;
public class DateArithmetic
{
public static void Main()
{
DateTimeOffset quarterDate = new DateTimeOffset(2010, 1, 1, 0, 0, 0, DateTimeOffset.Now.Offset);
for (int i = 1; i <= 4; i++)
{
Console.WriteLine("Quarter {0}: {1:MMMM d}", i, quarterDate);
quarterDate = quarterDate.AddMonths(3);
}
}
}
Related examples in the same category