Create a LocalDate from the given date string. Returns null
for an empty or null date string.

@param dateString the date string
@return the new LocalDate
491353
protected final LocalDate createLocalDate(final String dateString) {
        if (dateString == null || dateString.isEmpty()) {
            return null;
        }
        final DateParser parser = new DateParser(dateString);
        return new LocalDate(parser.getEstimateCalendar());
    }
943509
public static Date stringToDate(String dateText, String format,
                                    boolean lenient) {

        if (dateText == null) {

            return null;
        }

        DateFormat df = null;

        try {

            if (format == null) {
                df = new SimpleDateFormat();
            } else {
                df = new SimpleDateFormat(format);
            }

            // setLenient avoids allowing dates like 9/32/2001
            // which would otherwise parse to 10/2/2001
            df.setLenient(false);

            return df.parse(dateText);
        } catch (ParseException e) {

            return null;
        }
    }
1231150
public static MonthDay parse(String str, DateTimeFormatter formatter) {
        LocalDate date = formatter.parseLocalDate(str);
        return new MonthDay(date.getMonthOfYear(), date.getDayOfMonth());
    }
1144401
@CheckForNull
  public static LocalDate parseLocalDateQuietly(@Nullable String s) {
    LocalDate date = null;
    if (s != null) {
      try {
        date = parseLocalDate(s);
      } catch (RuntimeException e) {
        // ignore
      }

    }
    return date;
  }
704142
public static String formatDateString(String dateString, String format1, String format2) {
        if (dateString == null) {
            return null;
        }
        java.text.SimpleDateFormat beforeFormat = new java.text.SimpleDateFormat(format1);
        java.text.SimpleDateFormat endFormat = new java.text.SimpleDateFormat(format2);
        try {
            return endFormat.format(beforeFormat.parse(dateString));
        } catch (ParseException e) {
            e.printStackTrace();
            return dateString;
        }
    }
1146334
public static java.sql.Date convertDate(String date, Locale locale) {
        SimpleDateFormat df;
        java.util.Date dbDate = null;
        java.sql.Date sqldate = null;
        try {
            if (date == null || date.equals("")) {
                return null;
            }

            df = (SimpleDateFormat) DateFormat.getDateInstance(dateStyle, locale);

            SimpleDateFormat sdf = new SimpleDateFormat(df.toPattern());
            java.text.ParsePosition pos = new java.text.ParsePosition(0);
            sdf.setLenient(false);
            dbDate = sdf.parse(date, pos);
            return new java.sql.Date(dbDate.getTime());

        } catch (Exception e) {
            return null;
        }
    }
27072
public static LocalDateTime dateToLocalDateTime(Date date) {

        if (date == null) {
            return null;
        }
        return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
    }
1032986
public Date dateStringToDateFormat(String string)
    {
        try {
            if (string != null)
                return BaseXmlConvertToNative.gDateFormat.parse(string);
        } catch (ParseException ex) {
            ex.printStackTrace();
        }
        return null;
    }
225034
public static LocalDate firstDay(String localDate) {
        LocalDate parse = parse(localDate, DEFAULT_PATTERN);
        return LocalDate.of(parse.getYear(), parse.getMonth(), 1);
    }
866199
public static final <T extends Calendar> Function<T, LocalDate> calendarToLocalDate(DateTimeZone dateTimeZone) {
		return new CalendarToLocalDate<T>(dateTimeZone);
	}
1250277
public static Date parseCompressedISO8601Date(String dateString) {
        try {
            return new Date(compressedIso8601DateFormat.parseMillis(dateString));
        } catch (RuntimeException ex) {
            throw handleException(ex);
        }
   }
710646
public static Date toDate(String dateTimeString) throws ParseException {
        Instant instant = toInstant(dateTimeString);
        return (instant != null ? Date.from(instant) : null);
    }
1296738
public static Date parseServiceSpecificDate(String dateString) {
        if (dateString == null)
            return null;
        try {
            BigDecimal dateValue = new BigDecimal(dateString);
            return new Date(dateValue.scaleByPowerOfTen(
                    AWS_DATE_MILLI_SECOND_PRECISION).longValue());
        } catch (NumberFormatException nfe) {
            throw new SdkClientException("Unable to parse date : "
                    + dateString, nfe);
        }
    }
106840
@CheckForNull
  public static Date parseDateOrDateTime(@Nullable String stringDate) {
    if (stringDate == null) {
      return null;
    }

    OffsetDateTime odt = parseOffsetDateTimeQuietly(stringDate);
    if (odt != null) {
      return Date.from(odt.toInstant());
    }

    LocalDate ld = parseLocalDateQuietly(stringDate);
    checkArgument(ld != null, "Date '%s' cannot be parsed as either a date or date+time", stringDate);

    return Date.from(ld.atStartOfDay(ZoneId.systemDefault()).toInstant());
  }
296217
protected LocalDate toLocalDate(@Nullable final String inputDate) {
        return inputDate == null || inputDate.isEmpty() ? null : LocalDate.parse(inputDate, LOCAL_DATE_FORMATTER);
    }
332668
private static Date parse(final String dateString) {
		try {
			return new SimpleDateFormat("dd/mm/yyyy").parse(dateString);
		} catch (ParseException e) {
			LOG.error("Error parsing date: " + dateString, e);
			return null;
		}
	}
1195789
private static Date parseDate(@SuppressWarnings("SameParameterValue") String stringDate)
    {
        try {
            return formatter.parse(stringDate);
        } catch (ParseException e) {
            e.printStackTrace();
            return null;
        }
    }