List of utility methods to do String to Date
Date | stringToDate(String s, DateFormat formatter) Convert a date time string (e.g., "2011-06-07 19:12:18") to a Date object. try { return formatter.parse(s); } catch (ParseException e) { return null; |
Date | stringToDate(String s, String format) string To Date return new SimpleDateFormat(format).parse(s); |
Date | stringToDate(String sDate) string To Date SimpleDateFormat stringToDate; try { stringToDate = new SimpleDateFormat("dd/MM/yyyy"); return stringToDate.parse(sDate); } catch (ParseException e) { stringToDate = new SimpleDateFormat("yyyy-MM-dd"); return stringToDate.parse(sDate); |
java.util.Date | stringToDate(String source) string To Date TimeZone localTimeZone = getDateFormatter().getTimeZone();
return stringToDate(source, localTimeZone);
|
Date | stringToDate(String source, String format) string To Date SimpleDateFormat sdf = new SimpleDateFormat(format); try { if (format.equals(YYYY_MM_DD_HH_MM_SS) || format.equals(DATE_PATTERN_SS)) { if (source.length() < INIT_DATE_TIME.length()) { source += INIT_DATE_TIME.substring(source.length() + 1); return sdf.parse(source); ... |
Date | StringToDate(String str) String To Date String _pattern = "yyyy-MM-dd"; return StringToDate(str, _pattern); |
Date | stringToDate(String str) string To Date if (str == null) { return null; DateFormat defaultDate = DateFormat.getDateInstance(); Date date = null; try { date = defaultDate.parse(str); } catch (ParseException pe) { ... |
Date | stringToDate(String str, String format) string To Date if (str != null) { DateFormat dateFormat = new SimpleDateFormat(format); try { return dateFormat.parse(str); } catch (ParseException e) { return null; return null; |
Date | StringToDate(String str, String format) String To Date if (str == null) { return null; if (format == null) { format = "yyyy-MM-dd"; DateFormat df = new SimpleDateFormat(format); return df.parse(str); ... |
Date | stringToDate(String str, String formatStr) stringToDate. DateFormat format = new SimpleDateFormat(formatStr); return format.parse(str); |