List of utility methods to do TimeZone Create
String | getTimezoneAbbreviation(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; |
TimeZone | getTimeZoneChecked(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; |
String | getTimeZoneCorrectedProgramId(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) { ... |
TimeZone | getTimeZoneDefault() 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;
|
List | getTimeZoneList() 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();
|
Map | getTimeZoneMap() 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; |
TimeZone | getTimeZoneOfTenant() get Time Zone Of Tenant return TimeZone.getTimeZone(TENANT_TIME_ZONE);
|
int | getTotalTimeZoneOffset(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; |