Add a specified number of months to the current DateTimeOffset in CSharp

Description

The following code shows how to add a specified number of months to the current DateTimeOffset.

Example


using System;//  ww w  .  j a v  a2s  .  c om

public class MainClass{
  public static void Main(String[] argv){  
    DateTimeOffset quarterDate = new DateTimeOffset(2014, 1, 1, 0, 0, 0, 
                                     DateTimeOffset.Now.Offset);
    quarterDate = quarterDate.AddMonths(3);
    Console.WriteLine(quarterDate);

  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var