TimeSpan to string

In this chapter you will learn:

  1. Default output of ToString() method

Output TimeSpan to string

using System;//from j a  v a  2  s . co m

class MainClass
{
    static void CreateTimeSpan( long ticks )
    {

        TimeSpan interval = new TimeSpan(2, 14, 18);
        Console.WriteLine(interval.ToString());
    }
    static void Main( )
    {
        CreateTimeSpan( 999999 );                
    }     
}

The code above generates the following result.

Next chapter...

What you will learn in the next chapter:

  1. Get total properties from TimeSpan
Home » C# Tutorial » Date, Time, TimeZone
Compare DateTimeOffset
DateTimeOffset creation
Date time Value from DateTimeOffset
Compare DateTime value
DateTime constant value
DateTime constructor
DateTime properties
Create TimeSpan From
TimeSpan
TimeSpan add and subtract
DateTime and TimeSpan
Compare TimeSpan
TimeSpan constant
TimeSpan Constructor
TimeSpan Duration
TimeSpan format
Negate a TimeSpan
TimeSpan operators
Parse string to TimeSpan
TimeSpan to string
TimeSpan total properties
TimeSpan propeties
Daylight saving
Time zone ID
UTC offset with TimeZone
TimeZone converting
TimeZone creation