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.
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:
As far as i know there is no such method as setInstance() only getInstance()
Post a Comment