Trying to figure out time formatting is absolutely killing me.
When I press a button I collect a start time using:
StartTime = DateTime.Now.ToString("hh.mm.ss.tt")
Then when the calculation is done I have:
EndTime = DateTime.Now.ToString("hh.mm.ss.tt")
What I would like to do is to:
TotalTime = EndTime - StartTime
But to print the time using the format; “?# Hours, ## Minutes, & ## Seconds”
I probably wouldn’t use the
ToString()function on the StartTime and EndTime variables, since that turns them into strings.Try this:
Of course, you can skip the TotalTime variable and just calculate it in place: