@Test public void testConvertStringToDate() { DateTime date = DateUtils.convertStringToDate(EXPECTED_DATE_STAMP); Calendar cal = date.toGregorianCalendar(); Assert.assertEquals(TEST_YEAR, cal.get(Calendar.YEAR)); Assert.assertEquals(TEST_MONTH, cal.get(Calendar.MONTH)); Assert.assertEquals(TEST_DAY, cal.get(Calendar.DAY_OF_MONTH)); Assert.assertEquals(TEST_HOUR, cal.get(Calendar.HOUR_OF_DAY)); Assert.assertEquals(TEST_MINUTE, cal.get(Calendar.MINUTE)); Assert.assertEquals(TEST_SECOND, cal.get(Calendar.SECOND)); Assert.assertEquals(TEST_MILLIS, cal.get(Calendar.MILLISECOND)); }
public static DateTime convertStringToDate(String date) { if (date.length() > 19) { return DATE_TIME_FORMATTER.parseDateTime(date); } else { return DATE_TIME_FORMATTER.parseDateTime(date + ".000"); } }
DateUtils { public static DateTime convertStringToDate(String date) { if (date.length() > 19) { return DATE_TIME_FORMATTER.parseDateTime(date); } else { return DATE_TIME_FORMATTER.parseDateTime(date + ".000"); } } }
DateUtils { public static DateTime convertStringToDate(String date) { if (date.length() > 19) { return DATE_TIME_FORMATTER.parseDateTime(date); } else { return DATE_TIME_FORMATTER.parseDateTime(date + ".000"); } } private  DateUtils(); }
DateUtils { public static DateTime convertStringToDate(String date) { if (date.length() > 19) { return DATE_TIME_FORMATTER.parseDateTime(date); } else { return DATE_TIME_FORMATTER.parseDateTime(date + ".000"); } } private  DateUtils(); static String convertDateToString(DateTime date); static String convertSqlTimestampToString(Timestamp timestamp); static DateTime convertStringToDate(String date); static DateTime convertStringWithOffsetToDate(String date); }
DateUtils { public static DateTime convertStringToDate(String date) { if (date.length() > 19) { return DATE_TIME_FORMATTER.parseDateTime(date); } else { return DATE_TIME_FORMATTER.parseDateTime(date + ".000"); } } private  DateUtils(); static String convertDateToString(DateTime date); static String convertSqlTimestampToString(Timestamp timestamp); static DateTime convertStringToDate(String date); static DateTime convertStringWithOffsetToDate(String date);  }