TimeSpan.TicksPerDay : TimeSpan « System « C# / C Sharp by API






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

1.new TimeSpan(days, hours, minutes, seconds)
2.new TimeSpan(days, hours, minutes, seconds, milliseconds
3.new TimeSpan(ticks)
4.TimeSpan + TimeSpan
5.TimeSpan.Add(TimeSpan ts)
6.TimeSpan.Duration()
7.TimeSpan.FromDays
8.TimeSpan.Milliseconds
9.TimeSpan.Negate()
10.TimeSpan.Parse
11.TimeSpan.Subtract(TimeSpan ts)
12.TimeSpan.TotalDays