Forum Discussion

Adagio's avatar
Adagio
Frequent Contributor
7 years ago

Change the formatting of StopWatch.ToString() output

Hello,

I'm using StopWatch object on my UserForms, and to get the execution time, I use StopWatch.ToString() after the watch stops.

Current format of the output string is as given below - 

 

Test1 finished. Execution time: 00:00:05.000

 

I want to change the format to HH:MM:SS. Any suggestions would be appreciated.

 

Note: I've tried  using aqConvert util but didn't help.

 

Thank you

Abhi

1 Reply

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The "Stop" method returns an integer of the number of milliseconds passed.  You can convert that to whatever you want to by doing the necessary math.