DateTime starttime = DateTime.Now; DateTime endtime = DateTime.Now; string runtime = (endtime - starttime).ToString(); Console.WriteLine(runtime);