asp.net.ph

DateTime.AddMonths Method

System Namespace   DateTime Structure


Adds the specified number of months to the value of this instance.

[ VB ]
<Serializable>
Public Function AddMonths ( _
   ByVal months As Integer _
} As DateTime

[ C# ]
[ Serializable ]
public DateTime AddMonths (
   int months
};

[ C++ ]
[ Serializable ]
public: DateTime AddMonths (
   int months
};

[ JScript ]
public Serializable
function AddMonths (
   months : int
} : DateTime;

Parameters

months
A number of months. The months parameter can be negative or positive.

Return Value

A DateTime whose value is the sum of the date and time represented by this instance and months.

Exceptions


Exception Type Condition
ArgumentOutOfRangeException The resulting DateTime is less than MinValue or greater than MaxValue.

-or-

months is less than -120,000 or greater than 120,000.


Remarks

This method does not change the value of this DateTime. Instead, a new DateTime is returned whose value is the result of this operation.

See Also

DateTime Members   Double Skip Navigation Links




Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note