Timespan Start Stop Clock

by ssi 13. January 2016 09:48
DateTime dStopCLock = DateTime.Now;
TimeSpan ts = dStartCLock - dStopCLock;
double differenceInSeconds = ts.TotalSeconds;
ts = TimeSpan.FromSeconds(ts.TotalSeconds);
 
string sDuration = string.Format("Dur: {0:D2}h:{1:D2}m:{2:D2}s",
             ts.Hours,
             ts.Minutes,
             ts.Seconds);
Console.WriteLine(sDuration);

Tags:

CSharp

Add comment

biuquote
  • Comment
  • Preview
Loading

Calendar

<<  September 2025  >>
MoTuWeThFrSaSu
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

View posts in large calendar

RecentComments

None

Development Team @ Shelbysys

We develop custom database applications for our clients. Our development tool of choice is MS Visual Studio. 

Quotations

""If everyone is thinking alike, someone isn't thinking.""
- General George Patton Jr