@Test public void testToUtcDate() { val format = new SimpleDateFormat(dateFormat); format.setTimeZone(TimeZone.getTimeZone("UTC")); Date actual = DateUtil.toUtcDate(instString); try { val expected = format.parse("2016-11-07 21:51:40"); assertEquals(actual, expected); } catch (ParseException e) { e.printStackTrace(); } }
public static Date toUtcDate(String dateStr) { notNull(dateStr, "dateStr can't be null"); try { return buildDateFormat().parse(dateStr); } catch (ParseException e) { throw new RuntimeException(e); } }
DateUtil { public static Date toUtcDate(String dateStr) { notNull(dateStr, "dateStr can't be null"); try { return buildDateFormat().parse(dateStr); } catch (ParseException e) { throw new RuntimeException(e); } } }
DateUtil { public static Date toUtcDate(String dateStr) { notNull(dateStr, "dateStr can't be null"); try { return buildDateFormat().parse(dateStr); } catch (ParseException e) { throw new RuntimeException(e); } }  }
DateUtil { public static Date toUtcDate(String dateStr) { notNull(dateStr, "dateStr can't be null"); try { return buildDateFormat().parse(dateStr); } catch (ParseException e) { throw new RuntimeException(e); } }  static Date toUtcDate(String dateStr); static String toDateString(Instant instant); static String toUtcDateString(Instant instant); static Date now(); }
DateUtil { public static Date toUtcDate(String dateStr) { notNull(dateStr, "dateStr can't be null"); try { return buildDateFormat().parse(dateStr); } catch (ParseException e) { throw new RuntimeException(e); } }  static Date toUtcDate(String dateStr); static String toDateString(Instant instant); static String toUtcDateString(Instant instant); static Date now();  }