Mega Code Archive

 
Categories / C# / Date Time
 

Create a TimeSpan that represents a specified number of hours

using System; class FromHoursDemo {     static void GenTimeSpanFromHours( double hours )     {         TimeSpan    interval = TimeSpan.FromHours( hours );         string      timeInterval = interval.ToString( );         Console.WriteLine( timeInterval );     }      static void Main( )     {         GenTimeSpanFromHours( 24 );     }  }