This documentation is archived and is not being maintained.
DateTime.AddYears Method
.NET Framework 1.1
Adds the specified number of years to the value of this instance.
[Visual Basic] Public Function AddYears( _ ByVal value As Integer _ ) As DateTime [C#] public DateTime AddYears( int value ); [C++] public: DateTime AddYears( int value ); [JScript] public function AddYears( value : int ) : DateTime;
Parameters
- value
- A number of years. The value 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 the number of years represented by value.
Exceptions
| Exception Type | Condition |
|---|---|
| ArgumentOutOfRangeException | value or the resulting DateTime is less than MinValue or greater than MaxValue. |
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.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard
See Also
DateTime Structure | DateTime Members | System Namespace | Double
Show: