In this
topic, we are going to see how to manipulate Maximo dates using Automation scripts.
The different kinds of manipulation are
- Adding Number to the date
- Subtracting Number to the date
- Changing the format of the date
- Difference between two dates in days
In the below examples we are going to use Python scripts in Maximo
- Object Launch Point is used
- Asset object
- 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 ********************")