Mega Code Archive

 
Categories / C# / Date Time
 

Elapsed Time Today with TimeSpan

using System; public class Example {    public static void Main()    {       TimeSpan interval = DateTime.Now - DateTime.Now.Date;       string msg = String.Format("Elapsed Time Today: {0:d} hours.",interval);       Console.WriteLine(msg);    } }