Initializes a new instance of the TimeSpan class to a specified number of hours, minutes, and seconds.
[Visual Basic] Overloads Public Sub New( _ ByVal hours As Integer, _ ByVal minutes As Integer, _ ByVal seconds As Integer _ ) [C#] public TimeSpan( int hours, int minutes, int seconds ); [C++] public: TimeSpan( int hours, int minutes, int seconds ); [JScript] public function TimeSpan( hours : int, minutes : int, seconds : int );
Exception Type | Condition |
---|---|
ArgumentException | If any of the arguments are negative. |
OverflowException | If the computed ticks value is less than TimeSpan.MinValue or greater than TimeSpan.MaxValue. |
The Ticks value is computed by converting hours and minutes into seconds, and then multiplying the total number of seconds by TicksPerSecond. The equation is:
Ticks = ((long)hour * 3600 + (long)minute * 60 + (long)second) * TicksPerSecond
TimeSpan Structure | TimeSpan Members | System Namespace | TimeSpan Constructor Overload List | Int64