Timezone operations - script to Java migration

For the Timezone operations, not all of the script operations from the Script API are implemented in the Java™ API. Alternative Java code is provided for those script operations that are not implemented in the Java API.

Table 1. Script operations and alternative Java code for the Timezone operations
Script operation Alternative Java code
getUserTimeZoneDesc() getUserTimeZone() TimeZone tz = TimeZone.getTimeZone("IST"); tz.getDisplayName(new Locale("de", "DE"));
getUserTimeZoneOffset()
Context ctx = PIMContextFactory.getCurrentContext(); User usr  = ctx.getOrganizationManager().getUser("Admin"); String timeZone = usr.getUserSettingValue(UserSetting.TIMEZONE);

String offset = ctx.getTimezoneResolver().getOffsetFromEncodedForm(timeZone);
setUserTimeZone
Context ctx = PIMContextFactory.getCurrentContext();
User usr  = ctx.getOrganizationManager().getUser("Admin");
String encodedForm = ctx.getTimezoneResolver().getEncodedFormFromOffset(345);
usr.setUserSettingValue(UserSetting.TIMEZONE, encodedForm);
usr.save();
String parseTimeZoneToDBValue(String srcStr) getEncodedFormFromOffset(int offset)
Number getTimeZoneOffsetFromDBValue(String dbValue) getOffsetFromEncodedForm(String encodedTimezone)