Tuesday 26 May 2015

Automation Script - get current date and time.

In automation script, there is no implicit variable available to get current date and time. I followed below procedure, to get current date and time to set date time field.

from java.util import Calendar

#Create a instance for Calendar
cal = Calendar.setInstance();

#Get Current date and time by using cal.getTime()
currentDateTime = cal.getTime();

#AS I AM APPLYING THIS SCRIPT TO WORKTYPE OF WORKORDER, ALREADY DECLARED VARIABLES FOR WORKTYPE as worktype AND TARGSTARTDATE as tsd

if worktype="CM":
 tsd = currentDateTime


Hope it helps to someone who are new to set date time in automation script.

 

1 comment:

Anonymous said...

As far as i know there is no such method as setInstance() only getInstance()

Maximo SOAPUI error javax.xml.ws.WebServiceException

SOAPUI error while sending payload to below url (in cluster environment) http://localhost:9080/meaweb/services/MXASSET Error : <f...