List of utility methods to do TimeZone To
TimeZone | createTimeZoneFromDouble(double timeZoneOffsetInHours) create Time Zone From Double long offsetInMinutes = Math.round(timeZoneOffsetInHours * 60d); if (offsetInMinutes == 0) { return TimeZone.getTimeZone("GMT"); return TimeZone.getTimeZone(getTimeZoneString(offsetInMinutes * minutesToMillis)); |
Date | extractTimeZone(String strdate, Date thedate) extract Time Zone String tzSign = strdate.substring(strdate.length() - 6, strdate.length() - 5); String tzHour = strdate.substring(strdate.length() - 5, strdate.length() - 3); String tzMin = strdate.substring(strdate.length() - 2); if (tzSign.equals("-") || tzSign.equals("+")) { int h = Integer.parseInt(tzHour); int m = Integer.parseInt(tzMin); if (tzSign.equals("+")) { h = -1 * h; ... |
TimeZone | parseTimeZoneString(String timeZoneString) Parse the given timeZoneString value into a TimeZone . TimeZone timeZone = TimeZone.getTimeZone(timeZoneString); if ("GMT".equals(timeZone.getID()) && !timeZoneString.startsWith("GMT")) { throw new IllegalArgumentException("Invalid time zone specification '" + timeZoneString + "'"); return timeZone; |
void | setTimeZone(String name) Temporarily sets the default system timezone to the specified timezone ID. systemTimeZone.set(TimeZone.getDefault()); TimeZone.setDefault(TimeZone.getTimeZone(name)); |
String | timeZoneToCode(TimeZone tz) time Zone To Code return timeZoneToString(tz);
|
String | timeZoneToString(TimeZone tz) time Zone To String return tz != null ? tz.getID() : ""; |
Date | toLocalTZ(Date time, TimeZone localTimeZone) to Local TZ if (localTimeZone == null) { return time; return new Date(time.getTime() + (localTimeZone.getRawOffset() - TimeZone.getDefault().getRawOffset())); |