Forum Discussion

aPrivett's avatar
aPrivett
Occasional Contributor
6 years ago
Solved

Need utilitiy to format milliseconds to a time format like hh:mm:ss to save in the Log

In keyword testing (preferred), does TestComplete provide something that I can give a parameter of milliseconds like 7500 and it provides a pretty time, like 7:30.

 

I believe I've exhausted all available searching online, but I could be wrong. I actually hope I'm wrong about that.

 

I need this in order to log "quick to read" Counter values in the log doing Performance testing.

 

  • There is no built in utility that I know of to do what you're asking.  You will have to write some sort of custom code to convert a millisecond measurement to seconds.  

     

    Technically speaking, 7500 converted to a "pretty" time is simply 7.5 seconds.  It's simply a matter of doing an arithmetic operation after converting your string to a number.  In JavaScript, it would look something like

     

    function millisecondsToSeconds(time){
        return (aqConvert.VarToInt(time) / 1000);
    
    }

1 Reply

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    There is no built in utility that I know of to do what you're asking.  You will have to write some sort of custom code to convert a millisecond measurement to seconds.  

     

    Technically speaking, 7500 converted to a "pretty" time is simply 7.5 seconds.  It's simply a matter of doing an arithmetic operation after converting your string to a number.  In JavaScript, it would look something like

     

    function millisecondsToSeconds(time){
        return (aqConvert.VarToInt(time) / 1000);
    
    }