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

CSharp examples for System:DateTime Minute

Description

Returns a date in the future by minutes.

Demo Code

//   The contents of this file are subject to the New BSD
using System;// w  w w  .j a v a  2s .  co m

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

Related Tutorials