This article describes how a time offset can be added to or subtracted from the inbound data so that the result is compatible with the destination system's timezone.
When the source and destination systems being integrated are in with different time zones, this difference in any Date/Time fields will have to be accommodated by the Map to ensure that there are no discrepancies. For example, if the source data as well as the Atom a certain process is deployed to are associated with GMT while the destination system is hosted in EST, the time difference here would be four hours. Although the Map functions will perform the date format transformation implicitly, they will not adjust the offset hours.
The solution here is to include a Map function that performs the addition or subtraction of the number of hours through custom scripting. The Map Function, with Custom Scripting as the Category, takes five input values out of which 4 can be set to default depending on the endpoints involved.
Defining the Parameters
This can be done in multiple ways, depending on which approach best suits the process design. In most cases, all values except the inbound date will be static so adding default values to the Map Function would be the best approach. In other cases, properties can be defined for each of the five parameters and their values can be retrieved within the Map when required.
This set of default values, when passed as the input parameters to the script included below, convert time from UTC to EST. The date format is yyyy-MM-dd'T'HH:mm:ss.
SimpleDateFormat inDate = new SimpleDateFormat(InputFormat, Locale.ENGLISH);
SimpleDateFormat outDate = new SimpleDateFormat(OutputFormat, Locale.ENGLISH);
int minutesToAdd = (Hours * 60) + Minutes ;
Calendar C = Calendar.getInstance();
Date D = inDate.parse(InputDate);
OutputDate = ''
If the use case requires subtracting time from the inbound value, passing negative values to the input parameters Hours and/or Minutes would be the simplest way to implement it.