@Test public void testFromString() { Calendar gCal = GregorianCalendar.getInstance(); gCal.set(Calendar.DAY_OF_MONTH, 1); gCal.set(Calendar.MONTH, 2); gCal.set(Calendar.YEAR, 2013); gCal.set(Calendar.HOUR_OF_DAY, 22); gCal.set(Calendar.MINUTE, 21); gCal.set(Calendar.SECOND, 01); gCal.set(Calendar.MILLISECOND, 0); Date actualDate = DateUtil.dateFromString("2013-03-01 22:21:01"); Assert.assertEquals(gCal.getTime(), actualDate); }
public static Date dateFromString(String date) { try { return formatter.parse(date); } catch (ParseException e) { return null; } }
DateUtil { public static Date dateFromString(String date) { try { return formatter.parse(date); } catch (ParseException e) { return null; } } }
DateUtil { public static Date dateFromString(String date) { try { return formatter.parse(date); } catch (ParseException e) { return null; } } private  DateUtil(); }
DateUtil { public static Date dateFromString(String date) { try { return formatter.parse(date); } catch (ParseException e) { return null; } } private  DateUtil(); static String toString(Date date); static String toISO8601String(Date date); static Date dateFromString(String date); static Date nowDate(); }
DateUtil { public static Date dateFromString(String date) { try { return formatter.parse(date); } catch (ParseException e) { return null; } } private  DateUtil(); static String toString(Date date); static String toISO8601String(Date date); static Date dateFromString(String date); static Date nowDate();  }