@Test public void testStringToDateWithFormatNullDate() throws Exception { Date date = DateUtils.stringToDateWithFormat(null, DateFormatConstants.DATE_FORMAT_TIME); assertNotNull(date); }
public static Date stringToDateWithFormat(String stringToConvert, String dateFormat) { if (stringToConvert != null) { try { DateFormat simpleDateFormat = new SimpleDateFormat(dateFormat); Date date = simpleDateFormat.parse(stringToConvert); return date; } catch (ParseException e) { } } return new Date(0); }
DateUtils { public static Date stringToDateWithFormat(String stringToConvert, String dateFormat) { if (stringToConvert != null) { try { DateFormat simpleDateFormat = new SimpleDateFormat(dateFormat); Date date = simpleDateFormat.parse(stringToConvert); return date; } catch (ParseException e) { } } return new Date(0); } }
DateUtils { public static Date stringToDateWithFormat(String stringToConvert, String dateFormat) { if (stringToConvert != null) { try { DateFormat simpleDateFormat = new SimpleDateFormat(dateFormat); Date date = simpleDateFormat.parse(stringToConvert); return date; } catch (ParseException e) { } } return new Date(0); } private  DateUtils(); }
DateUtils { public static Date stringToDateWithFormat(String stringToConvert, String dateFormat) { if (stringToConvert != null) { try { DateFormat simpleDateFormat = new SimpleDateFormat(dateFormat); Date date = simpleDateFormat.parse(stringToConvert); return date; } catch (ParseException e) { } } return new Date(0); } private  DateUtils(); static Date stringToDateWithFormat(String stringToConvert, String dateFormat); static String dateToStringWithFormat(Date dateToString, String dateFormat); }
DateUtils { public static Date stringToDateWithFormat(String stringToConvert, String dateFormat) { if (stringToConvert != null) { try { DateFormat simpleDateFormat = new SimpleDateFormat(dateFormat); Date date = simpleDateFormat.parse(stringToConvert); return date; } catch (ParseException e) { } } return new Date(0); } private  DateUtils(); static Date stringToDateWithFormat(String stringToConvert, String dateFormat); static String dateToStringWithFormat(Date dateToString, String dateFormat);  }