IBM has a support article on this topic here:
Unfortunately, the code provided is incorrect and will throw an exception if you try to use it.
Here's the corrected code:
// set up variables to set the erlaststatuschangedate attribute// get milliseconds since epoch in local time zone.var mydate = new Date().valueOf();// get milliseconds of offset from Zulu/UTCvar localOffset = new Date().getTimezoneOffset() * 60000;// add/subtract milliseconds based on local timezone to get Zulu time.var myTZ = mydate + localOffset;// create a new Date() object representing "now" in Zulu time.var utcDate = new Date(myTZ);// Format the date into a string in the correct formatvar myTZStr = new java.text.SimpleDateFormat("yyyyMMddHHmm").format(utcDate) ; // Add "Z" to the end of the string to complete the correct format.var myTZStrZ = myTZStr + "Z";// set the value of erlaststatuschangedatework.setAttribute("erlaststatuschangedate",myTZStrZ);
No comments:
Post a Comment