Tuesday 10 April 2018

Python - setting Date and Time using automation Scripts

The python version used Maximo automation scripts is 2.5.2. So the normal DateTime function in Python cannot be used in Maximo. The DateTime function is used in Python 3.x and above. As an alternative, we can use the gmtime and strftime packages.

from time import gmtime
from time import strftime
nowTime = strftime("%Y-%m-%dT%H:%M:%S", gmtime())
print(nowTime)
mbo.setValue("TARGSTARTDATE", nowTime)
print("TARGSTARTDATE-->" + mbo.getString("TARGSTARTDATE"))


1 comment:

  1. Thank you very much it is very useful topic

    ReplyDelete