How show minutes and seconds with Stopwatch()

前端 未结 7 466
北荒
北荒 2021-02-01 12:20

I need to show also the minutes, actually I use this code for show the seconds, but also need the minutes

TimeSpan ts = stopwatch.Elapsed;
Console.WriteLine(\"F         


        
7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-01 13:09

    //try it

           Stopwatch sw = new Stopwatch();
    
            sw.Start();
    
            Thread.Sleep(10382);
    
            sw.Stop();
    
    
            Console.Write(sw.Elapsed.Duration());
    

提交回复
热议问题