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