List of utility methods to do Date Value Check
boolean | isDateValid(String dateString, String validFormat) is Date Valid DateFormat df; df = (validFormat == null) ? new SimpleDateFormat("yyyy-MM-dd") : new SimpleDateFormat(validFormat); df.setLenient(false); try { df.parse(dateString); return true; } catch (ParseException e) { return false; ... |
boolean | isDateValid(String dateToCheck, String pattern) Checks a string to see if it contains a valid date in SimpleDateFormat .
if (dateToCheck == null || pattern == null) return (false); boolean result = false; try { java.util.Date in = parseDate(dateToCheck, pattern); String out = dateToString(in, pattern); if (dateToCheck.compareTo(out) == 0) { result = true; ... |
boolean | isDateValid(String dateToValidate) Validates the revision date. if (dateToValidate == null || !dateToValidate.matches(DATE_PATTERN)) { return false; SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); sdf.setLenient(false); try { sdf.parse(dateToValidate); } catch (ParseException e) { ... |
boolean | isDateValue(String inputString) DOC zqin Comment method "isDateValue". if (!isEmpty(inputString)) { try { DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); df.setLenient(false); df.parse(inputString); return true; } catch (Exception e) { return false; ... |
boolean | isValidateData(String val) is Validate Data try { convertToDate(val, "yyyy-MM-dd"); return true; } catch (Exception ex) { return false; |
boolean | isValidDate(DateFormat sdf, String date) is Valid Date try { sdf.parse(date); } catch (ParseException e) { return false; } catch (RuntimeException e) { return false; return true; ... |
boolean | isValidDate(final String date, final String format, final boolean lenient) Checks if the Date is valid to convert. boolean isValid = true; if (date == null || format == null || format.length() <= 0) { return false; final DateFormat df = new SimpleDateFormat(format); df.setLenient(lenient); try { df.parse(date); ... |
boolean | isValidDate(final String date, final String format, final Locale locale) Performs date validation checking like Feb 30, etc. if (date == null || format == null) { return false; List<String> replaced = new ArrayList<String>(); String regex = createRegexFromDateFormat(format.trim(), replaced); DateFormatSymbols dateFormatSymbols; if (locale == null) { dateFormatSymbols = DateFormatSymbols.getInstance(); ... |
boolean | isValidDate(String createDate, String startDate) is Valid Date try { SimpleDateFormat format = new SimpleDateFormat(C_DATE_PATTON_DEFAULT); Date cdate = format.parse(createDate); Date sdate = format.parse(startDate); if (cdate.getTime() >= sdate.getTime()) { return true; } else { return false; ... |
boolean | isValidDate(String date) checks if the date is valid or not try { @SuppressWarnings("unused") Date dateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSSSS") .parse(date.trim() + " 00:00:00.000000"); } catch (Exception ex) { return false; return true; ... |