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!

DateTime.AddYears

Returns the DateTime result from adding this instance to the specified number of years.

[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.

Return Value

DateTime results from adding the specified number of years to this instance.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException If the resulting DateTime is outside the supported range.

Remarks

The AddYears method is computed by incrementing or decrementing the year part of this instance of DateTime by the number of specified years.

For example, if the month and day of this DateTime is 2/29 and if the resulting year is not a leap year, the month and day of the resulting DateTime becomes 2/28. Otherwise, the month, day, and time-of-day parts of the result are the same as those of this DateTime.

The value parameter argument can be either positive or negative.

See Also

DateTime Structure | DateTime Members | System Namespace | Int32 | Calendar | Year