Regarding Timezone UTC to ADT/AST conversion

Hi Team,

I am not able to convert UTC -04 to ADT format (yyyy-MM-dd ‘T’ HH:mm:ss. SSXXX)

My system time is ADT, but while running the built in date/time format service not giving desired output, please advice do i need to create any java service or need to use any other pattern. below is the pattern:

                                                                                           Input                         Output 

UTC -à ADT ( -3 hrs from UTC) — 2019-03-22T05:49:34.857-04:00 2019-03-22T02:49:34
UTC - à AST ( -4 Hrs From UTC – 2019-03-22T05:49:34.857-04:00 2019-03-22T01:49:34

If possbile, please share the java code for the same.For reference attached screenshot.


Saw your post on other social media, check the below code if that helps, I had written this for one of the clients in the past, also, look at thread How to convert timezone in ESB service - webMethods - Software AG Tech Community & Forums

public static final void formatDateTimeZone (IData pipeline)
    throws ServiceException
	// --- <<IS-START(formatDateTimeZone)>> ---
	// @sigtype java 3.5
	// [i] field:0:required inString
	// [i] field:0:required currentPattern
	// [i] field:0:required newPattern
	// [i] field:0:required timezone
	// [o] field:0:required value
	IDataCursor cursor = pipeline.getCursor();
	String inString = IDataUtil.getString( cursor, "inString" );
	String currentPattern = IDataUtil.getString( cursor, "currentPattern" );
	String newPattern = IDataUtil.getString( cursor, "newPattern" );
	String timezone = IDataUtil.getString( cursor, "timezone" );
	SimpleDateFormat format = new SimpleDateFormat( currentPattern );
	Date currentDate;
		currentDate = format.parse(inString );
	catch( Throwable t )
		throw new ServiceException(t);
	format = new SimpleDateFormat(newPattern);
	String value = format.format(currentDate);
	IDataUtil.put(cursor, "value", value);
	// --- <<IS-END>> ---