CSharp examples for System:DateTime Day
Will give you the DateTime object given the number of days you go back.
using System;//from w ww . j a v a 2 s . c o m public class Main{ /// <summary> /// Will give you the DateTime object given the number of days you go back. /// </summary> /// <param name="days"> /// The days. /// </param> /// <returns> /// DateTime object /// </returns> public static DateTime DaysAgo(this int days) { var t = new TimeSpan(days, 0, 0, 0); return DateTime.Now.Subtract(t); } }