@Test public void shouldCreateDateFromValidStringAndFormat() throws Exception { String dateString = "2012/04/10"; String format = "yyyy/MM/dd"; Date date = DateUtil.createDateFromString(dateString, format); DateTime jodaDate = new DateTime(date); assertThat(jodaDate.getDayOfMonth()).isEqualTo(10); assertThat(jodaDate.getMonthOfYear()).isEqualTo(04); assertThat(jodaDate.getYear()).isEqualTo(2012); }
public static Date createDateFromString(String date, String format) throws ParseException { if (date == null) { throw new IllegalArgumentException("Date is null!"); } DateFormat df = new SimpleDateFormat(format); return df.parse(date); }
DateUtil { public static Date createDateFromString(String date, String format) throws ParseException { if (date == null) { throw new IllegalArgumentException("Date is null!"); } DateFormat df = new SimpleDateFormat(format); return df.parse(date); } }
DateUtil { public static Date createDateFromString(String date, String format) throws ParseException { if (date == null) { throw new IllegalArgumentException("Date is null!"); } DateFormat df = new SimpleDateFormat(format); return df.parse(date); }  }
DateUtil { public static Date createDateFromString(String date, String format) throws ParseException { if (date == null) { throw new IllegalArgumentException("Date is null!"); } DateFormat df = new SimpleDateFormat(format); return df.parse(date); }  static Date createDateFromString(String date, String format); static String formatDate(Date date, String format); static String formatDateTime(Date date); static String formatDate(Date date); static Date createDate(int year, int month, int day); }
DateUtil { public static Date createDateFromString(String date, String format) throws ParseException { if (date == null) { throw new IllegalArgumentException("Date is null!"); } DateFormat df = new SimpleDateFormat(format); return df.parse(date); }  static Date createDateFromString(String date, String format); static String formatDate(Date date, String format); static String formatDateTime(Date date); static String formatDate(Date date); static Date createDate(int year, int month, int day); static final String DATE_FORMAT_YYYYMMDD; static final String DATE_TIME_FORMAT_YYYYMMDD_HHMM; }