List of utility methods to do String to Date
Date | transformStringToDate(String dateString) transform String To Date Date date; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { date = simpleDateFormat.parse(dateString); } catch (ParseException e) { e.printStackTrace(); date = new Date(); return date; |
Date | translateToDate(String aDate, String aFormat) Takes a string representing a date and converts it to a real date according to a given format. SimpleDateFormat dateFormatter = new SimpleDateFormat(); dateFormatter.applyPattern(aFormat); Date returnDate = dateFormatter.parse(aDate); return returnDate; |