Skip to Content
0
Aug 11, 2020 at 07:45 AM

CBTA Enter current time

45 Views

Hi,

I have an automated testcase using CBTA where I enter the current time in a SAP GUI screen. The format of the time should be "hh:mm:ss".

I started with this:

%=hour(now())&":"&minute(now())&":"&second(now())%

But that doesn't work in all cases. If current time for example is "12:05:09", the above function will result in "12:5:9" which causes an error.

After some time, I found this solution for that problem:

%=hour(now())&":"&right("0"&minute(now()),2)&":"&right("0"&second(now()),2)%

It works, but I don't find it very "aesthetically pleasing". Maybe there is an easier solution. Any ideas?

Attachments

5grnh.png (8.9 kB)
ofuzc.png (8.2 kB)