TimestampUtils { public static Date getDateForISO8601String(String time) throws ParseException { return ISO8601Utils.parse(time, new ParsePosition(0)); }  static String getReadableDate(long time); static Date getDateForISO8601String(String time); static String getISO8601StringForTime(long time); static Integer getDaysBetweenDates(@Nullable Date date);  }
@Test public void shouldParseISO8601TimeCorrectly() throws Exception { Date expected = new Date(1505257442000l); String ts = "2017-09-12T23:04:02.000Z"; Date d = TimestampUtils.getDateForISO8601String(ts); System.out.println(d.getTime()); Assert.assertNotNull(d); Assert.assertEquals(expected, d); Assert.assertEquals(d.getTime(), 1505257442000l); }