DateTime..::..AddMonths Method
Returns a new DateTime that adds the specified number of months to the value of this instance.
Namespace:
SystemAssembly: Bridge (in Bridge.dll)
Syntax
[TemplateAttribute] public DateTime AddMonths( int months )
<TemplateAttribute> _ Public Function AddMonths ( _ months As Integer _ ) As DateTime
[TemplateAttribute] public: DateTime^ AddMonths( int^ months )
Parameters
- months
- Type: System..::..Int32
A number of months. The months parameter can be negative or positive.
Return Value
An object whose value is the sum of the date and time represented by this instance and months.Exceptions
Exception | Condition |
---|---|
System..::..ArgumentOutOfRangeException | The resulting DateTime is less than MinValue or greater than MaxValue.-or- months is less than -120,000 or greater than 120,000. |