For a given datetime instance returns a new datetime, representing the next year from the current date. - CSharp System

CSharp examples for System:DateTime Year

Description

For a given datetime instance returns a new datetime, representing the next year from the current date.

Demo Code


using System.Globalization;
using System;/*from  ww w .  ja  v a  2  s .  com*/

public class Main{
        /// <summary>
    ///   <para>For a given date/time instance returns a new date/time, representing the next year from the current date.</para>
    /// </summary>
    /// <param name="self">Original date/time object instance.</param>
    /// <returns>New date/time object instance that represents the year after the year of the specified <paramref name="self"/>.</returns>
    /// <seealso cref="DateTime.AddYears(int)"/>
    /// <seealso cref="PreviousYear(DateTime)"/>
    public static DateTime NextYear(this DateTime self)
    {
      return self.AddYears(1);
    }
}

Related Tutorials