List of utility methods to do String to Date
Date | toDate(String dateString, String dateFormatPattern) Converts a String to a Date, using the specified pattern. Date date = null; if (dateFormatPattern == null) { dateFormatPattern = "yyyy-MM-dd"; synchronized (dateFormat) { dateFormat.applyPattern(dateFormatPattern); dateFormat.setLenient(false); date = dateFormat.parse(dateString); ... |
Date | toDate(String dateString, String format) to Date try { DateFormat fmt = new SimpleDateFormat(format); return fmt.parse(dateString); } catch (ParseException e) { return null; |
Date | toDate(String datetime) to Date SimpleDateFormat sdf; sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); try { return sdf.parse(datetime); } catch (ParseException e) { return EPOCH; |
Date | toDate(String dateToConvert) This function takes a timezone string and converts it to a Java Date SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); Date date = formatter.parse(dateToConvert); return date; |
Date | toDate(String dateToDatify) Creer une date GMT try { return sdf.parse(dateToDatify); } catch (ParseException e) { return null; |
Date | toDate(String dateValue, String format) to Date Date value = null; try { value = newDateFormat(format).parse(dateValue); } catch (Exception e) { return value; |
Date | toDate(String format, String str) to Date Date date = null; if (format == null) { sdf.applyPattern("yyyy-MM-dd HH:mm:ss"); } else { sdf.applyPattern(format); try { date = sdf.parse(str); ... |
Date | toDate(String formatDate, String stringDate) to Date if (stringDate == null || stringDate.isEmpty()) { return null; SimpleDateFormat format = new SimpleDateFormat(formatDate); return format.parse(stringDate); |
Date | toDate(String param) to Date Date date = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { date = sdf.parse(param); } catch (ParseException ex) { return date; |
Date | toDate(String patten, String value) To date. DateFormat formater = new SimpleDateFormat(patten); try { return formater.parse(value); } catch (ParseException e) { throw new IllegalArgumentException(e); |