List of utility methods to do String to Date
java.util.Date | toDate(String strDate) to Date try { java.util.Date date = dateFormat.parse(strDate.trim(), new ParsePosition(0)); return date; } catch (Exception e) { return null; |
Date | toDate(String strDate) Convert string date to Date with #FULL_DATE_FORMAT . SimpleDateFormat fullDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); return fullDateFormat.parse(strDate); |
Date | toDate(String string) to Date int whichFormatter = 0; if (string.indexOf('/') > 0) { whichFormatter |= 0x01; if (string.indexOf(':') > 0) { whichFormatter |= 0x02; final DateFormat formatter; ... |
Date | toDate(String string, String format) to Date DateFormat dateFormat = new SimpleDateFormat(format); dateFormat.setLenient(true); Date d; try { d = dateFormat.parse(string); } catch (ParseException pe) { throw new IllegalArgumentException(pe); return d; |
Date | toDate(String time) to Date if (time == null) { return null; try { TimeZone tz = TimeZone.getTimeZone("UTC"); DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSS"); df.setTimeZone(tz); return df.parse(time); ... |
Date | toDate(String time) to Date DateFormat df = new SimpleDateFormat(DATE_FORMAT); return df.parse(time); |
Date | toDate(String ts) to Date Date dts = TS_FORMAT.parse(ts);
return dts;
|
Date | toDate(String value) Gets the date value of the input string value. try { if (value != null) { SimpleDateFormat df = new SimpleDateFormat(isoDateStringFormat); return df.parse(value); } catch (Exception ex) { return null; ... |
Date | toDateByFormat(String dateString, String formatStr) to Date By Format java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(formatStr); try { return sdf.parse(dateString); } catch (ParseException ex) { ex.printStackTrace(); return null; |
java.util.Date | toDateByPattern(String dateTime) to Date By Pattern return toDateByPattern(dateTime, defaultDatePattern);
|