Forum Discussion

Mis3's avatar
Mis3
Frequent Contributor
3 years ago
Solved

Timestamp

I used the following code to output the exact time of teststep execution in a loop.

------------------------------------------------------------------------------------------

def log_date = new Date()
def sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")

...

...

report << "\n"+ sdf.format(log_date)+" Seq="+i+","+data[0]+ ","+msisdn_1 + ",Result:"+MESSAGE1+"-"+MESSAGE2+","+MESSAGE3+","+MESSAGE4+ ","+MESSAGE5+","+MESSAGE6+ ","+ MESSAGE7+ ","+ MESSAGE8

------------------------------------------------------------------------------------------

What should I do if I want to output only the time; ie: 08:50:33 (not in log.info but in the report)?

Thanks.

 

Current:

08/23/2021 09:12:26 Seq=15,2041231234,12041231234,Result:40-objectDoesNotExist,null,null,null,null,,
08/23/2021 09:12:26 Seq=16 Invalid line [1203]
08/23/2021 09:12:26 Seq=17,14313140097,14313140097,Result:0-success,302130000006120,320,null,100,101112,100101102103

New:

09:12:26 Seq=15,2041231234,12041231234,Result:40-objectDoesNotExist,null,null,null,null,,
09:12:26 Seq=16 Invalid line [1203]
09:12:26 Seq=17,14313140097,14313140097,Result:0-success,302130000006120,320,null,100,101112,100101102103

 

 

  • Please remove MM/dd/yyyy.