Mega Code Archive

 
Categories / C# / Date Time
 

Create a TimeSpan instance, specifying the days, hours, minutes, and seconds

using System; class MainClass {     public static void Main() {         int hours = 4;         int minutes = 12;         int seconds = 10;         int days = 1;         TimeSpan myTimeSpan2 = new TimeSpan(days, hours, minutes, seconds);         Console.WriteLine("myTimeSpan2 = " + myTimeSpan2);     } }