Monday 8 March 2021

Maximo Date Manipulation Using Automation Scripts

In this topic, we are going to see how to manipulate Maximo dates using Automation scripts. The different kinds of manipulation are

  1. Adding Number to the date
  2. Subtracting Number to the date
  3. Changing the format of the date
  4. Difference between two dates in days 

In the below examples we are going to use Python scripts in Maximo

  1. Object Launch Point is used
  2. Asset object
  3. The “INSTALLDATE” attribute is modified

  Java Calendar class is used for Date Manipulation.


1.     Adding Number to the date

Current date from MXServer is got and adding number (10) to that date.

print("**************Start of C_TEST ********************")
from java.util import Date
from java.util import Calendar
from psdi.server import MXServer

currentDate = MXServer.getMXServer().getDate()
cal = Calendar.getInstance()
cal.setTime(currentDate)

cal.add(Calendar.DATE, 10) 

print ("After Additional to Current Date ---> ",cal.getTime()) 

mbo.setValue("INSTALLDATE",cal.getTime()) 
print("**************End of C_TEST ********************")