List of utility methods to do TimeZone Get
java.util.Calendar | getTimeInCurrentDay(long now, TimeZone tz, int hour, int minute, int second, int millisecond) get Time In Current Day java.util.Calendar cal = java.util.Calendar.getInstance(tz);
cal.setTimeInMillis(now);
cal.set(java.util.Calendar.HOUR_OF_DAY, hour);
cal.set(java.util.Calendar.MINUTE, minute);
cal.set(java.util.Calendar.SECOND, second);
cal.set(java.util.Calendar.MILLISECOND, millisecond);
return cal;
|
long | getTimeTry(boolean lenient, TimeZone tz, int year, int month, int day, int hour, int minute, int second, int millis) get Time Try Calendar c; if (tz == null) { c = getCalendar(); } else { c = Calendar.getInstance(tz); synchronized (c) { c.clear(); ... |
Calendar | getTimeWithTimeZone(final String timezoneId) get Time With Time Zone final TimeZone timeZone = TimeZone.getTimeZone(timezoneId); final Calendar timeWithZone = Calendar.getInstance(timeZone); return timeWithZone; |
TimeZone | getTimeZone(Calendar cal) Gets the active time zone based on a Calendar argument if (cal == null) { return defaultZone; return cal.getTimeZone(); |
TimeZone | getTimeZone(final String ID) get Time Zone return TimeZone.getTimeZone(ID);
|
TimeZone | getTimeZoneByOffSet(String offSetInString) get Time Zone By Off Set String timeZoneID = ""; Short offSetInShort = Short.parseShort(offSetInString); if (offSetInShort > 0) { timeZoneID = "GMT+" + offSetInShort; } else { timeZoneID = "GMT" + offSetInShort; return TimeZone.getTimeZone(timeZoneID); ... |
int | getTimezoneDifference(String timezone1, String timezone2) get Timezone Difference Calendar lCalendar = new GregorianCalendar(TimeZone.getTimeZone(timezone1)); lCalendar.setTimeInMillis(new Date().getTime()); int Timezone1HourOfDay = lCalendar.get(Calendar.HOUR_OF_DAY); int Timezone1DayOfMonth = lCalendar.get(Calendar.DAY_OF_MONTH); lCalendar = new GregorianCalendar(TimeZone.getTimeZone(timezone2)); lCalendar.setTimeInMillis(new Date().getTime()); int TimezoneHourOfDay = lCalendar.get(Calendar.HOUR_OF_DAY); int TimezoneDayOfMonth = lCalendar.get(Calendar.DAY_OF_MONTH); ... |
String | getTimeZoneID() get Time Zone ID return TimeZone.getDefault().getID();
|
Map | getTimeZoneIDs() get Time Zone I Ds return __timeZoneIDs;
|
String | getTimeZoneOffset() get Time Zone Offset Calendar cal = Calendar.getInstance(); TimeZone currentTimeZone = cal.getTimeZone(); Calendar currentDt = new GregorianCalendar(currentTimeZone, Locale.US); int gmtOffset = currentTimeZone.getOffset(currentDt.get(0), currentDt.get(1), currentDt.get(2), currentDt.get(5), currentDt.get(7), currentDt.get(14)); int hour = gmtOffset / 3600000; int min = Math.abs((gmtOffset - hour * 3600000) / 60000); return "" + hour + ":" + min; ... |