List of utility methods to do String to Date
Date | StringToDate(String Expression) String To Date return StringToDate(Expression, defaultPattern);
|
Date | StringToDate(String fecha) String To Date SimpleDateFormat formatoDelTexto = new SimpleDateFormat("yyyy/MM/dd"); Date aux = null; try { aux = formatoDelTexto.parse(fecha); } catch (Exception ex) { return aux; |
Date | stringToDate(String fecha, String formato) string To Date fecha = nullToBlank(fecha); GregorianCalendar gc = new GregorianCalendar(); SimpleDateFormat df = new SimpleDateFormat(formato); try { gc.setTime(df.parse(fecha)); return gc.getTime(); } catch (ParseException e) { System.out.println("Error con fecha: " + e.getMessage()); ... |
Date | StringToDate(String format, String dateStr) String To Date SimpleDateFormat dateFormat = new SimpleDateFormat(format); try { Date date = dateFormat.parse(dateStr.trim()); return date; } catch (Exception e) { e.printStackTrace(); return null; ... |
Date | stringToDate(String input) string To Date Date date = null; String dateFormat = getDateFormat(input); if (dateFormat == null) { throw new IllegalArgumentException("Date is not in an accepted format " + input); for (String sep : dateSeparators) { String actualDateFormat = patternForSeparator(dateFormat, sep); for (String time : timeFormats) { ... |
java.util.Date | stringToDate(String pstrValue, String pstrDateFormat) Convert string to Date if ((pstrValue == null) || (pstrValue.equals(""))) { return null; java.util.Date dttDate = null; try { SimpleDateFormat oFormatter = new SimpleDateFormat(pstrDateFormat); dttDate = oFormatter.parse(pstrValue); oFormatter = null; ... |
Date | stringToDate(String s) string To Date SimpleDateFormat sd = new SimpleDateFormat(DATE_FORMAT); Date date = sd.parse(s); return date; |
Date | StringToDate(String s) String To Date Date date = new Date(); try { SimpleDateFormat simpledateformat = new SimpleDateFormat(PATTERN_YMDHMS); ParsePosition parseposition = new ParsePosition(0); date = simpledateformat.parse(s, parseposition); } catch (Exception ex) { return date; ... |
Date | stringToDate(String s) string To Date if (s == null) return null; try { return _df.parse(s); } catch (Exception e) { return null; |
Date | StringToDate(String s) String To Date return StringToDate(s, "yyyy-MM-dd hh:mm:ss"); |