TimeSpan.TicksPerDay
using System;
using System.Globalization;
class MainClass {
public static void Main() {
// Create some date/time objects
DateTime dt = new DateTime();
DateTime dt1 = new DateTime(2001, 12, 31);
DateTime dt2 = new DateTime(2000, 12, 31, 23, 59, 59);
// Do some date time math
DateTime today = DateTime.Today;
today = today + new TimeSpan(TimeSpan.TicksPerDay);
Console.WriteLine("Tomorrow is: {0}", today.ToString());
today = DateTime.Today - new TimeSpan(7 * TimeSpan.TicksPerDay);
Console.WriteLine("Last Week on this day it was: {0}",today.ToString());
}
}
Related examples in the same category