Ask a Question

Stop Watch string object


Stop Watch string object

I get the time in milliseconds from -

 set StopWatchObj1 = histuils.stopwatch


I need to store this in a excel sheet so I use the function aqtime.writetotextfile to write it in a .csv file which I can open in excel. 

The resut of stopwatchobj1.tostring in the .csv file when I open as text file shows the right string "0:00:02:690".

When I open the same in excel, I see the result as 00:00:2

Is there a way I can get the same format in excel??
Occasional Contributor

RE: Stop Watch string object

If you're using that Excel sheet just to manually view the values which
TC has output, then you can change the cell formatting in Excel by going
to Format -> Format Cells... (keyboard shortcut "Ctrl + 1").  On the "Number" tab choose the "Custom" option, and then on the right in the "Type" textbox enter:


Then click OK and it should appear correctly on the spreadsheet.

RE: Stop Watch string object

Yeah.. i do that.. but is there a way the enduser can view the same format without doing any workaround..

I have to give my scripts to my client.. when they view the result sheet they should be able to get it.

Thanks for your replly...

RE: Stop Watch string object

In that case you'll have to modify the value before it gets written to the csv file. There are two options:

1) Preceed the value with a single quote to force it to be interpreted as a string, as follows:


2) Change the last colon to a decimal point and it should be interpreted as a time, as follows:


RE: Stop Watch string object

Hi Madhi,

Please note that this forum is actually for AutomatedQA TestComplete functionality questions, not for questions on Microsoft Excel.

Best regards,

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

RE: Stop Watch string object

I understand this forum is not for excel.  My question is totally related to the output from HISUtils stopwatch object

I tried the aqdatetime.Timeinterval to fnd out the difference between the two results i get from stopwatch.  Looks like i need to have date format as well to use the timeinterval method.  Do you have any suggestion to calculate the difference

The output from stopwatch object.tostring is in the format hh:mm:ss.000

Occasional Contributor

RE: Stop Watch string object

You can get the elapsed milliseconds from the StopWatch.Split() and StopWatch.Stop() methods.


function StopWatchTest()


  var stopWatch = HISUtils.StopWatch;






  var startTime = stopWatch.Split();




  var endTime = stopWatch.Stop();


  Log.Message("Start time: " + startTime + "ms");

  Log.Message("End time: " + endTime + "ms");

  Log.Message("Duration: " + (endTime - startTime) + "ms");

Showing results for 
Search instead for 
Did you mean: