We can convert the normal date format to Maximo date format (yyyy-mm-ddThh:mm:ss.ffffff) using Automation Script.
Script Language: javascript
load("nashorn:mozilla_compat.js"); importPackage(Packages.java.text); erData.breakData(); var actualDate = erData.getCurrentData("ACTUALDATE"); print("INPUT : " +actualDate); var inputFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a"); var outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); var dateParse = inputFormat.parse(actualDate); var maximoDate = (outputFormat.format(dateParse)).replace(" ", "T") +"+05:30"; print("OUTPUT : " +maximoDate); erData.setCurrentData("ACTUALDATE", maximoDate);
Output:
INPUT : 4/20/2021 03:30:52 PM OUTPUT : 2021-04-20T15:30:52+08:00
No comments:
Post a Comment