List of utility methods to do LocalDate from String
LocalDate | getLocalDateForString(final String string) get Local Date For String return LocalDate.parse(string, DateTimeFormatter.ofPattern(PATTERN_DATE));
|
LocalDate | getLocalDateFromString(String sDate) get Local Date From String if (sDate == null || sDate.trim().isEmpty()) { return null; DateTimeFormatter dateTimeFormatter; LocalDate lDate = null; try { dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); lDate = LocalDate.parse(sDate, dateTimeFormatter); ... |
Optional | parseLocalDate(String dateString) parse Local Date try { return Optional.of(DEFAULT_DATE_FORMATTER.parse(dateString, LocalDate::from)); } catch (DateTimeParseException e) { return Optional.empty(); |
LocalDate | parseLocalDate(String inPattern, String inDate) parse Local Date final DateTimeFormatter f = DateTimeFormatter.ofPattern(inPattern); return LocalDate.from(f.parse(inDate)); |
LocalDate | parseLocalDate(String localDate) parse Local Date DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); return LocalDate.parse(localDate, formatter); |
LocalDate | parseStringToLocalDate(String strDate) Parses a String into a LocalDate return LocalDate.parse(strDate, localDateFormatter);
|
LocalDate | toLocalDate(String date) to Local Date DateTimeFormatter format = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss", Locale.getDefault()); return LocalDate.parse(date, format); |
LocalDate | toLocalDate(String date) to Local Date return LocalDate.parse(date, DATE_FORMAT);
|
LocalDate | toLocalDate(String dateValue) This method parse date from String object to LocalDate object. return LocalDate.parse(trimQuotes(dateValue), DateTimeFormatter.ofPattern("M/dd/yyyy")); |