CSharp examples for System:DateTime Second
Gets a date in the past according to seconds
// The contents of this file are subject to the New BSD using System;//from w w w. j a va 2 s .c o m public class Main{ /// <summary> /// Gets a date in the past according to seconds /// </summary> /// <param name="seconds">The seconds.</param> /// <returns></returns> public static DateTime SecondsAgo(this int seconds) { TimeSpan t = new TimeSpan(0, 0, seconds); return DateTime.Now.Subtract(t); } }