AddYears() public static méthode

Adds years to the given date.
public static AddYears ( System time, int years ) : System.DateTime
time System The /// to which to add /// months. ///
years int The number of years to add.
Résultat System.DateTime
        /// <summary>Returns a <see cref="T:System.DateTime" /> that is the specified number of years away from the specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>The <see cref="T:System.DateTime" /> that results from adding the specified number of years to the specified <see cref="T:System.DateTime" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to which to add years. </param>
        /// <param name="years">The number of years to add. </param>
        /// <exception cref="T:System.ArgumentException">The resulting <see cref="T:System.DateTime" /> is outside the supported range. </exception>
        public override DateTime AddYears(DateTime time, int years)
        {
            DateTime dateTime = CCGregorianCalendar.AddYears(time, years);

            this.M_CheckDateTime(dateTime);
            return(dateTime);
        }
Exemple #2
0
        /// <summary>
        /// Overridden. Adds years to a given date.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> to which to add
        /// years.
        /// </param>
        /// <param name="years">The number of years to add.</param>
        /// <returns>A new <see cref="T:System.DateTime"/> value, that
        /// results from adding <paramref name="years"/> to the specified
        /// DateTime.</returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if
        /// <see cref="T:System.DateTime"/> return value is outside all
        /// supported eras.
        /// </exception>
        public override DateTime AddYears(DateTime time, int years)
        {
            DateTime t = CCGregorianCalendar.AddYears(time, years);

            M_CheckDateTime(t);
            return(t);
        }
Exemple #3
0
 /// <summary>Returns a <see cref="T:System.DateTime" /> that is the specified number of years away from the specified <see cref="T:System.DateTime" />.</summary>
 /// <returns>The <see cref="T:System.DateTime" /> that results from adding the specified number of years to the specified <see cref="T:System.DateTime" />.</returns>
 /// <param name="time">The <see cref="T:System.DateTime" /> to which to add years. </param>
 /// <param name="years">The number of years to add. </param>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///   <paramref name="years" /> or <paramref name="time" /> is out of range.</exception>
 public override DateTime AddYears(DateTime time, int years)
 {
     return(CCGregorianCalendar.AddYears(time, years));
 }