Utils { public static long dateTimeToLong(String date) { long timestamp = 0L; try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSSzzz"); Date parsedDate = dateFormat.parse(date); timestamp = parsedDate.getTime(); } catch (ParseException e) { LOG.warn("{}", e); } if (timestamp == 0L) { LOG.warn("Not able to parse date: " + date); } return timestamp; }  static void closeInputStream(InputStream is); static void sleep(long seconds); static long dateTimeToLong(String date); static long parseMemory(String memory); static Constants.JobType fetchJobType(Map config); static Constants.JobType fetchJobType(Configuration config); static String makeLockPath(String zkrootWithSiteId);  }
@Test public void testDateTimeToLong() { long timestamp = Utils.dateTimeToLong("2016-11-11T19:35:40.715GMT"); Assert.assertEquals(1478892940715l, timestamp); timestamp = Utils.dateTimeToLong("2016-11-11T19:35:40.715GXMT"); Assert.assertEquals(0l, timestamp); }