C# TimeSpan TimeSpan(Int32, Int32, Int32, Int32)
Description
TimeSpan TimeSpan(Int32, Int32, Int32, Int32)
initializes
a new instance of the TimeSpan structure to a specified number of days, hours,
minutes, and seconds.
Syntax
TimeSpan.TimeSpan(Int32, Int32, Int32, Int32)
has the following syntax.
public TimeSpan(/*from w w w .j av a 2 s . c o m*/
int days,
int hours,
int minutes,
int seconds
)
Parameters
TimeSpan.TimeSpan(Int32, Int32, Int32, Int32)
has the following parameters.
days
- Number of days.hours
- Number of hours.minutes
- Number of minutes.seconds
- Number of seconds.
Example
The following example creates several TimeSpan objects using the constructor overload that initializes a TimeSpan to a specified number of days, hours, minutes, and seconds.
using System;/*w w w .j a va 2s .c o m*/
class Example
{
static void Main( )
{
TimeSpan elapsedTime = new TimeSpan( 10, 20, 30, 40 );
Console.WriteLine(elapsedTime.ToString( ) );
}
}
The code above generates the following result.