Returns a date in the future by days. - CSharp System

CSharp examples for System:DateTime Day

Description

Returns a date in the future by days.

Demo Code

//   The contents of this file are subject to the New BSD
using System;//from   ww w .java  2 s  . c  om

public class Main{
        /// <summary>
    ///  Returns a date in the future by days.
    /// </summary>
    /// <param name="days">The days.</param>
    /// <returns></returns>
    public static DateTime DaysFromNow(this int days) {
        TimeSpan t = new TimeSpan(days, 0, 0, 0);
        return DateTime.Now.Add(t);
    }
}

Related Tutorials