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

CSharp examples for System:DateTime Second

Description

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

Demo Code


using System;//from w ww.ja  v  a 2s .co  m

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

Related Tutorials