NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

GregorianCalendar.AddMonths

Returns the DateTime resulting from adding the given number of months to the specified DateTime.

[Visual Basic]
Overrides Public Function AddMonths( _
   ByVal time As DateTime, _
   ByVal months As Integer _
) As DateTime
[C#]
public override DateTime AddMonths(
   DateTime time,
   int months
);
[C++]
public: override DateTime AddMonths(
   DateTime time,
   int months
);
[JScript]
public override function AddMonths(
   time : DateTime,
   months : int
) : DateTime;

Parameters

time
The DateTime instance to be added.
months
A number of months (positive or negative).

Remarks

The result is computed by incrementing (or decrementing) the year and month parts of the specified DateTime by the value of months, and, if required, adjusting the day part of the resulting date downwards to the last day of the resulting month in the resulting year. The time-of-day part of the result is the same as the time-of-day part of the specified DateTime.

In more precise terms, considering the specified DateTime to be of the form y/ m/ d + t, where y is the year, m is the month, d is the day, and t is the time-of-day, the result is y1/ m1/ d1 + t, where y1 and m1 are computed by adding months to y and m, and d1 is the largest value less than or equal to d that denotes a valid day in month m1 of year y1.

See Also

GregorianCalendar Class | GregorianCalendar Members | System.Globalization Namespace