Easily use Javascript in test case

How can I easily use Javascript in a test case.

I used to do it with Selenium IDE and I can’t figure out how to run a simple JS command for datetime.

I used to use:

storeEval var d=new Date(); d.getDate()+ '_' + ((d.getMonth()+1)) + '_' +d.getFullYear() + '_' +d.getHours() + d.getMinutes() + d.getSeconds(); MyDate
 

Any help would be appreciated. I am new to Katalon, so would like a bit ore details.

 

Thanks in Advance!

 

If all you need is just the current date & time, you can do that with groovy using the below code.

def now = new Date()
def currentTime = now.format("MM/dd/yyyy -HH:mm:ss.SSS", TimeZone.getTimeZone('UTC'))

You can format the output to any format you want, I have separated the day, month & year with / and time with : … Hope this helps!!