Java Date Value Check isValidDate(String createDate, String startDate)

Here you can find the source of isValidDate(String createDate, String startDate)

Description

is Valid Date

License

Apache License

Declaration

public static boolean isValidDate(String createDate, String startDate) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static final String C_DATE_PATTON_DEFAULT = "yyyy-MM-dd";

    public static boolean isValidDate(String createDate, String startDate) {
        try {//from  w w  w  .  j av a2 s . c om
            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;
            }
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return false;
    }
}

Related

  1. isDateValue(String inputString)
  2. isValidateData(String val)
  3. isValidDate(DateFormat sdf, String date)
  4. isValidDate(final String date, final String format, final boolean lenient)
  5. isValidDate(final String date, final String format, final Locale locale)
  6. isValidDate(String date)
  7. isValidDate(String date)
  8. isValidDate(String date, String dateFormat)
  9. isValidDate(String date, String format)