C# TimeSpan FromHours
Description
TimeSpan FromHours
returns a TimeSpan that represents
a specified number of hours, where the specification is accurate to the nearest
millisecond.
Syntax
TimeSpan.FromHours
has the following syntax.
public static TimeSpan FromHours(
double value
)
Parameters
TimeSpan.FromHours
has the following parameters.
value
- A number of hours accurate to the nearest millisecond.
Returns
TimeSpan.FromHours
method returns An object that represents value.
Example
The following example creates several TimeSpan objects using the FromHours method.
using System;/*from w ww.jav a 2s . c o m*/
class MainClass
{
static void Main( )
{
TimeSpan interval = TimeSpan.FromHours( 0.000123456 );
string timeInterval = interval.ToString( );
Console.WriteLine( timeInterval );
}
}
The code above generates the following result.