Forum Discussion

sshah1's avatar
sshah1
Contributor
9 years ago

How to convert time value in Milliseconds?

Hi,

I have time value as string like this - 0000:00:05.016

Is it possible with TestComplete to --

1) Convert above string to time

2) Get total time as Milliseconds - 5016 ms

 

aqConvert["StrToTime"]("0000:00:05.016"); - does not work

 

Thanks,

Samixa

 

 

  • If you are using jScript you can create a date using

    var d = new Date(year, month, day, hours, minutes, seconds, milliseconds);

    so you can create date and manupulate as you like eg

    var d = new Date(2016,00,28,16,45,19,50)
    Log.Message(d)
    Log.Message(d.getMilliseconds()+d.getSeconds()*1000);

    for more http://www.w3schools.com/jsref/jsref_obj_date.asp

  • Thanks for your response. Yes, it works.