Forum Discussion

Oussama's avatar
Occasional Contributor
10 years ago

Getting Start and end Date of Running Project

Hello,   I would like to develop a scipt (JScript) which using the folowing variable: -- Start date/Time of lunching project -- End date/time  -- Duration How can i do this ?   Thank you.
  • Ryan_Moran's avatar
    10 years ago

    This will allow for you to attain the duration in milliseconds:

    //record start time
    var start = new Date().getTime();
        run scripts
    //record end time
    var end = new Date().getTime();

    //calculate the duration in milliseconds
    var duration = (end - start);

    //in seconds
    var durationseconds = duration / 1000;

    //so on and so forth


    You can use TestComplete's built in methods to attain the date and time:

    //Log the start time of the script
    Log.Message("Script was started at: " + aqDateTime.Now());
        run scripts
    //Log the stop time of the script
    Log.Message("Script was stopped at: " + aqDateTime.Now());