CSharp examples for System:DateTime Day
Returns a date in the past by days.
// The contents of this file are subject to the New BSD using System;/*w w w . j a v a2s . c o m*/ public class Main{ #region Date Math /// <summary> /// Returns a date in the past by days. /// </summary> /// <param name="days">The days.</param> /// <returns></returns> public static DateTime DaysAgo(this int days) { TimeSpan t = new TimeSpan(days, 0, 0, 0); return DateTime.Now.Subtract(t); } }