My Oracle Support Banner

System date format is different per timezone when updating Date field using SDK (Doc ID 3042753.1)

Last updated on AUGUST 22, 2024

Applies to:

Oracle Agile PLM Framework - Version 9.3.6.0 and later
Information in this document applies to any platform.

Symptoms

When using the below code to update a date field, the resulting data is bad when the user preference for time zone is other that PDT.

import com.agile.agileDSL.ScriptObj.IBaseScriptObj
import com.agile.px.IEventAction
import com.agile.px.IEventInfo
import com.agile.px.IObjectEventInfo
import com.agile.px.EventConstants
import com.agile.api.IChange
import com.agile.api.ChangeConstants;
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.time.format.DateTimeFormatter
import java.util.Date
import java.time.*

void invokeScript(IBaseScriptObj obj) {

    IEventInfo req = obj.getPXEventInfo();
    IObjectEventInfo info=(IObjectEventInfo)req;
    int eventType=req.getEventType();
    int triggerType=req.getEventTriggerType();
    if( (eventType ==EventConstants.EVENT_CHANGE_STATUS_FOR_WORKFLOW ) )
    {
        IChange changeOrder = (IChange)info.getDataObject();
        String newChangeType =changeOrder.getValue(ChangeConstants.ATT_COVER_PAGE_CHANGE_TYPE) != null ? changeOrder.getValue(ChangeConstants.ATT_COVER_PAGE_CHANGE_TYPE).toString():"";
        if (newChangeType.equals("ECO")  || newChangeType.equals("NPR") ||  newChangeType.equals("MCO")) {

           String strDateNow = ZonedDateTime.now(ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss a z"));
           changeOrder.setValue(ChangeConstants.ATT_PAGE_TWO_DATE03, strDateNow);
           obj.logMonitor("Time: "  +  adt);

        }
    }
//        obj.logMonitor("Time: "  + formattedInstant);
}

 

Changes

 When user preference is PDT, the update works and the time would show correctly for example "07/22/2024 05:09:59 PM PDT". However the same update for a user that has preference of CET will be "0013/11/14 12:49:12 PM CET"

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.