C# TimeSpan TimeSpan(Int32, Int32, Int32)

Description

TimeSpan TimeSpan(Int32, Int32, Int32) initializes a new instance of the TimeSpan structure to a specified number of hours, minutes, and seconds.

Syntax

TimeSpan.TimeSpan(Int32, Int32, Int32) has the following syntax.


public TimeSpan(/*from  w ww  .j  a v a 2s  . c om*/
  int hours,
  int minutes,
  int seconds
)

Parameters

TimeSpan.TimeSpan(Int32, Int32, Int32) has the following parameters.

  • 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 hours, minutes, and seconds.


// Example of the TimeSpan( int, int, int ) constructor. 
using System;
/*from ww  w . j  a  va 2 s  .com*/
class TimeSpanCtorIIIDemo
{
    static void Main( )
    {
        TimeSpan elapsedTime = new TimeSpan( 10, 20, 30 );
    } 
} 

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version