Java Utililty Methods TimeZone Create

List of utility methods to do TimeZone Create

Description

The list of methods to do TimeZone Create are organized into topic(s).

Method

StringgetTimezoneAbbreviation(String tzid, boolean dst)
get Timezone Abbreviation
if (tzid == null)
    return null;
for (int tzindex = 0; tzindex < ZONE_INFO.length; tzindex++) {
    if (tzid.equalsIgnoreCase(ZONE_INFO[tzindex][0]))
        return dst ? ZONE_INFO[tzindex][4] : ZONE_INFO[tzindex][2];
return null;
TimeZonegetTimeZoneChecked(String id)
get Time Zone Checked
TimeZone tz = TimeZone.getTimeZone(id);
if (!tz.getID().equals(id)) {
    throw new IllegalArgumentException("illegal timezone id " + id);
return tz;
StringgetTimeZoneCorrectedProgramId(String progID)
Gets the time zone corrected program id of the given program id.
int index = progID.lastIndexOf('_');
String timeString = progID.substring(index + 1);
int hourIndex = timeString.indexOf(':');
int offsetIndex = timeString.lastIndexOf(':');
if (hourIndex != offsetIndex) {
    int timeZoneOffset = Integer.parseInt(timeString.substring(offsetIndex + 1));
    int currentTimeZoneOffset = TimeZone.getDefault().getRawOffset() / 60000;
    if (timeZoneOffset != currentTimeZoneOffset) {
...
TimeZonegetTimeZoneDefault()
get Time Zone Default
return null != System.getProperty(TIME_ZONE) ? TimeZone.getTimeZone(System.getProperty(TIME_ZONE)) : null;
String[]getTimeZoneIds()
get Time Zone Ids
String[] ids = TimeZone.getAvailableIDs();
sort(ids);
return ids;
ListgetTimeZoneList()
get Time Zone List
List<String> timeZones = new ArrayList<String>();
for (String timeZone : TimeZone.getAvailableIDs()) {
    timeZones.add(timeZone);
return timeZones;
String[]getTimezoneList()
get Timezone List
return TimeZone.getAvailableIDs();
MapgetTimeZoneMap()
Returns a list of available time zones.
Map<String, String> timeZoneMap = new TreeMap<String, String>();
for (String timeZoneId : TimeZone.getAvailableIDs()) {
    timeZoneMap.put(timeZoneId, timeZoneId);
return timeZoneMap;
TimeZonegetTimeZoneOfTenant()
get Time Zone Of Tenant
return TimeZone.getTimeZone(TENANT_TIME_ZONE);
intgetTotalTimeZoneOffset(TimeZone zone)
Required to correctly account for all factors when dealing with TimeZones.
int r = zone.getRawOffset();
if (zone.useDaylightTime()) {
    r += zone.getDSTSavings();
return r;