TimeSpan propeties
In this chapter you will learn:
Date time properties from TimeSpan
using System;/* jav a 2 s . c o m*/
public class Example
{
public static void Main()
{
TimeSpan interval = new TimeSpan(3, 16, 42, 45, 750);
Console.WriteLine("Value of TimeSpan: {0}", interval);
Console.WriteLine("{0:N5} days, as follows:", interval.TotalDays);
Console.WriteLine(" Days: {0,3}", interval.Days);
Console.WriteLine(" Hours: {0,3}", interval.Hours);
Console.WriteLine(" Minutes: {0,3}", interval.Minutes);
Console.WriteLine(" Seconds: {0,3}", interval.Seconds);
Console.WriteLine(" Milliseconds: {0,3}", interval.Milliseconds);
}
}
Next chapter...
What you will learn in the next chapter:
- Get daylight saving information
- Get daylight changes
- Is daylight saving time
- GetAdjustmentRules returns a declarative summary of all daylight saving rules
Home » C# Tutorial » Date, Time, TimeZone