using System;
class MainClas
{
public static void Main()
{
long ticks = 300;
TimeSpan myTimeSpan = new TimeSpan(ticks);
Console.WriteLine("myTimeSpan.Days = " + myTimeSpan.Days);
Console.WriteLine("myTimeSpan.Hours = " + myTimeSpan.Hours);
Console.WriteLine("myTimeSpan.Minutes = " + myTimeSpan.Minutes);
Console.WriteLine("myTimeSpan.Seconds = " + myTimeSpan.Seconds);
Console.WriteLine("myTimeSpan.Milliseconds = " + myTimeSpan.Milliseconds);
Console.WriteLine("myTimeSpan.Ticks = " + myTimeSpan.Ticks);
Console.WriteLine("myTimeSpan.TotalDays = " + myTimeSpan.TotalDays);
Console.WriteLine("myTimeSpan.TotalHours = " + myTimeSpan.TotalHours);
Console.WriteLine("myTimeSpan.TotalMinutes = " + myTimeSpan.TotalMinutes);
Console.WriteLine("myTimeSpan.TotalSeconds = " + myTimeSpan.TotalSeconds);
Console.WriteLine("myTimeSpan.TotalMilliseconds = " + myTimeSpan.TotalMilliseconds);
}
}
myTimeSpan.Days = 0
myTimeSpan.Hours = 0
myTimeSpan.Minutes = 0
myTimeSpan.Seconds = 0
myTimeSpan.Milliseconds = 0
myTimeSpan.Ticks = 300
myTimeSpan.TotalDays = 3.47222222222222E-10
myTimeSpan.TotalHours = 8.33333333333333E-09
myTimeSpan.TotalMinutes = 5E-07
myTimeSpan.TotalSeconds = 3E-05
myTimeSpan.TotalMilliseconds = 0.03
13.5.TimeSpan |
| 13.5.1. | Create a TimeSpan representing 2.5 days |
| 13.5.2. | TimeSpan calculation |
| 13.5.3. | Manual Profiler |
| 13.5.4. | Create a TimeSpan representing 1 week |
| 13.5.5. | Use the Add() method to add a TimeSpan to a DateTime |
| 13.5.6. | Use the Subtract() method to subtract a TimeSpan from a DateTime |
| 13.5.7. | Create a TimeSpan instance, specifying the hours, minutes, and seconds |
| 13.5.8. | Create a TimeSpan instance, specifying the days, hours, minutes,and seconds |
| 13.5.9. | Create a TimeSpan instance, specifying the days, hours, minutes, seconds, and milliseconds |
| 13.5.10. | Create a TimeSpan instance, specifying the number of ticks |
| 13.5.11. | Display the properties for myTimeSpan |
| 13.5.12. | Measures the time taken to add some numbers |
| 13.5.13. | Use the FromDays(), FromHours(), FromMinutes(), FromSeconds(), FromMilliseconds(), and FromTicks() methods to create new TimeSpan instances |
| 13.5.14. | Use the Add() method to add a TimeSpan instance to another |
| 13.5.15. | Use the Subtract() method to subtract a TimeSpan instance from another |
| 13.5.16. | Use the Duration() method to add two TimeSpan instances |
| 13.5.17. | Use the Negate() method to add two TimeSpan instances |