Returns a new datetime instance, representing a point in time greater than the current by specified . - CSharp System

CSharp examples for System:DateTime Convert

Description

Returns a new datetime instance, representing a point in time greater than the current by specified .

Demo Code


using System.Globalization;
using System;//from ww  w .  ja  v  a  2s  .  c o m

public class Main{
        /// <summary>
    ///   <para>Returns a new date/time instance, representing a point in time greater than the current by specified <see cref="TimeSpan"/>.</para>
    /// </summary>
    /// <param name="self">Time span to add to current date/time.</param>
    /// <returns>Current date/time, incremented by the <paramref name="self"/>, expressed as a local time.</returns>
    public static DateTime FromNow(this TimeSpan self)
    {
      return DateTime.Now.Add(self);
    }
}

Related Tutorials