Forum Discussion

malj67's avatar
malj67
Occasional Contributor
16 years ago

Converting Log Date Format

I am developing a custom test type (in VB6) for Quality Center using TestComplete. I need to report test results to Quality Center. I could do this in two ways. I could report the results after each step (from within TestComplete script) or I could parse the log after the test has finished (outside of TestComplete, in VB6). 



Since there is no way to catch and handle exceptions in VBScript, which is the language we use in TestComplete, and report this as an error to Quality Center, I would instead like to report results after the test has finished.



I now have a problem. I am not able to convert the "date" properties from the log items to anything useful. When I parse the log I get things like "40157.6223187153" as a string from the XML file. How can I convert this to something useful? In VB6 I am able to use CDate(40157.6223187153) to convert to a date but what am I to do if I have a string? I have tried CDate(CDbl("40157.6223187153")) but that gives me an overflow. Any ideas?



I also have a related question. I first thought I could use the "date" property to decide in which order items are presented in the log. That seems to be impossible since the "date" property is often equal for more than one log item. Is there any other way to find out in which order log items are presented, i.e the order in which I would like to report results to Quality Center? 





5 Replies

  • kerr's avatar
    kerr
    Occasional Contributor
    I have a similar problem.

    I parse the log files and get (among other things) start/end time in its float form (like 40634.4261095833). I use JScript (from TestComplete 7 if it matters) and I can't find a way to convert these values into something readable (like "12:34:45 03/04/2011").

    Could you please help?
  • kerr's avatar
    kerr
    Occasional Contributor
    I did, and I found there nothing on converting a string like "40634.4261095833" into a DateTime object. That's why I'm asking this question. I've also read everything related to this issue on msdn.com. So could you please point out where I should look more precisely?..

    aqConvert.StrToDateTime recognizes dates in the formats like "dd/mm/yyyy", and not the floating point variant, so it doesn't work.

    ToDateObject function doesn't take a string like "40634.4261095833" either.

    I also tried to convert the string to float, and then pass the result to aqConvert or something, but it didn't work as well.