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