Sunday 18 August 2019

Playing with Dates in Jython Automation Script | IBM Maximo


SimpleDateFormat - String
from java.util import Date
from java.text import SimpleDateFormat

vCurrentDate = SimpleDateFormat("MM/dd/yyyy").format(Date())
vReportDate = SimpleDateFormat("MM/dd/yyyy").format(mbo.getDate("reportdate"))
if vReportDate > '08/18/2019' or vReportDate > vCurrentDate  :
    mbo.setValue("DESCRIPTION",str(vReportDate))


Date Utility - Get Current Date Only (00:00 midnight) 

https://developer.ibm.com/static/site-id/155/maximodev/7609/maximocore/businessobjects/psdi/app/common/DateUtility.html

from java.util import Date
from psdi.app.common import DateUtility

today = DateUtility.getDate(Date())

yesterday = DateUtility.addDays(today, -1)

AddDays = DateUtility.addDays(today, 5)

AddMinutes = DateUtility.addMinutes(today, 2)