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

<<  May 2024  >>
MoTuWeThFrSaSu
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

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

"Procrastination is, hands down, our favorite form of self-sabotage"
Alyce P. Cornyn-Selby