2

I want to print the date time in LoadRunner using C language. Currently this is what I have.

Action()
{
    lr_save_datetime("%Y-%m-%dT%H:%M:%S%z", DATE_NOW, "curr_dtm");
    // this is -> 2022-03-08T10:25:09+0800

    lr_output_message(lr_eval_string("{curr_dtm}"));
    
    return 0;
}

I want it to be like 2022-03-08T10:06:47+08:00 where the timezone has colon.

Wani M
  • 33
  • 3

1 Answers1

1

OK. You have a string with everything except the colon. You have a substring of the first n-2 characters which are correct. You need to append another string to this substring with a ':00'

Use the standard C string processing functions to cut out the substring which is correct, append a string in the format you want, and save that to a new string. Exercise those C programming skills!

James Pulley
  • 5,606
  • 1
  • 14
  • 14
  • While technically correct, this is an answer that the author probably didn't want to hear. – David Střelák Aug 22 '23 at 14:01
  • If you are going to use a performance testing tool, it would be wise to be (a) proficient in the language of the tool and (b) proficient in programming concepts and skills. Both of these are foundation class skills for performance testers – James Pulley Aug 22 '23 at 14:04