AddMonths() публичный статический Метод

Adds months to the given date.
public static AddMonths ( System time, int months ) : System.DateTime
time System The /// to which to add /// months. ///
months int The number of months to add.
Результат System.DateTime
Пример #1
0
        /// <summary>Returns a <see cref="T:System.DateTime" /> that is the specified number of months 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 months to the specified <see cref="T:System.DateTime" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to which to add months. </param>
        /// <param name="months">The number of months to add. </param>
        /// <exception cref="T:System.ArgumentException">The resulting <see cref="T:System.DateTime" /> is outside the supported range. </exception>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="months" /> is less than -120000.-or- <paramref name="months" /> is greater than 120000. </exception>
        public override DateTime AddMonths(DateTime time, int months)
        {
            DateTime dateTime = CCGregorianCalendar.AddMonths(time, months);

            this.M_CheckDateTime(dateTime);
            return(dateTime);
        }
Пример #2
0
        /// <summary>
        /// Overrideden. Adds months to a given date.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> to which to add
        /// months.
        /// </param>
        /// <param name="months">The number of months to add.</param>
        /// <returns>A new <see cref="T:System.DateTime"/> value, that
        /// results from adding <paramref name="months"/> 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 AddMonths(DateTime time, int months)
        {
            DateTime t = CCGregorianCalendar.AddMonths(time, months);

            M_CheckDateTime(t);
            return(t);
        }
Пример #3
0
 /// <summary>Returns a <see cref="T:System.DateTime" /> that is the specified number of months 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 months to the specified <see cref="T:System.DateTime" />.</returns>
 /// <param name="time">The <see cref="T:System.DateTime" /> to which to add months. </param>
 /// <param name="months">The number of months to add. </param>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///   <paramref name="months" /> is less than -120000.-or- <paramref name="months" /> is greater than 120000. </exception>
 public override DateTime AddMonths(DateTime time, int months)
 {
     return(CCGregorianCalendar.AddMonths(time, months));
 }