Will give you the DateTime object given the number of days you go forward. - CSharp System

CSharp examples for System:DateTime Day

Description

Will give you the DateTime object given the number of days you go forward.

Demo Code


using System;//w w  w  .  j  av a 2 s  .  c  o  m

public class Main{
        /// <summary>
        /// Will give you the DateTime object given the number of days you go forward.
        /// </summary>
        /// <param name="days">
        /// The days.
        /// </param>
        /// <returns>
        /// DateTime object
        /// </returns>
        public static DateTime DaysFromNow(this int days)
        {
            var t = new TimeSpan(days, 0, 0, 0);
            return DateTime.Now.Add(t);
        }
}

Related Tutorials