@Test public void testGetTimeZone() { Map<String, String> tests = new HashMap<>(); tests.put("", TimeZone.getDefault().getID()); tests.put("GMT", "GMT"); tests.put("GMT+1", "GMT+01:00"); tests.put("GMT+1:00", "GMT+01:00"); tests.put("GMT+01:00", "GMT+01:00"); tests.put("GMT-1", "GMT-01:00"); tests.put("GMT-1:00", "GMT-01:00"); tests.put("GMT-01:00", "GMT-01:00"); tests.put("GMT1", "GMT"); tests.put("GMT1:00", "GMT"); tests.put("GMT01:00", "GMT"); tests.put("UTC1", "GMT"); tests.put("UTC1:00", "GMT"); tests.put("UTC01:00", "GMT"); tests.put("UTC-1", "GMT"); tests.put("UTC-1:00", "GMT"); tests.put("UTC-01:00", "GMT"); tests.put("CST", "CST"); tests.put("CDT", "GMT"); tests.put("America/Los_Angeles", "America/Los_Angeles"); tests.forEach((input, expected) -> { String actual = TimeUtil.getTimeZone(input).getID(); assertEquals(String.format("For input: %s", input), expected, actual); }); }
public static TimeZone getTimeZone(String timezone) { if (StringUtils.isEmpty(timezone)) { return TimeZone.getDefault(); } return TimeZone.getTimeZone(timezone); }
TimeUtil { public static TimeZone getTimeZone(String timezone) { if (StringUtils.isEmpty(timezone)) { return TimeZone.getDefault(); } return TimeZone.getTimeZone(timezone); } }
TimeUtil { public static TimeZone getTimeZone(String timezone) { if (StringUtils.isEmpty(timezone)) { return TimeZone.getDefault(); } return TimeZone.getTimeZone(timezone); }  }
TimeUtil { public static TimeZone getTimeZone(String timezone) { if (StringUtils.isEmpty(timezone)) { return TimeZone.getDefault(); } return TimeZone.getTimeZone(timezone); }  static Long str2Long(String timeStr); static String format(String timeFormat, long time, TimeZone timeZone); static TimeZone getTimeZone(String timezone); }
TimeUtil { public static TimeZone getTimeZone(String timezone) { if (StringUtils.isEmpty(timezone)) { return TimeZone.getDefault(); } return TimeZone.getTimeZone(timezone); }  static Long str2Long(String timeStr); static String format(String timeFormat, long time, TimeZone timeZone); static TimeZone getTimeZone(String timezone);  }