Java Date Value Check isValidDate(String date, String dateFormat)

Here you can find the source of isValidDate(String date, String dateFormat)

Description

is Valid Date

License

Open Source License

Declaration

public static boolean isValidDate(String date, String dateFormat) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {

    public static boolean isValidDate(String date, String dateFormat) {
        try {/*from  w  w  w . jav  a2 s .  c o  m*/
            new SimpleDateFormat(dateFormat).parse(date);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}

Related

  1. isValidDate(final String date, final String format, final boolean lenient)
  2. isValidDate(final String date, final String format, final Locale locale)
  3. isValidDate(String createDate, String startDate)
  4. isValidDate(String date)
  5. isValidDate(String date)
  6. isValidDate(String date, String format)
  7. isValidDate(String dateStr)
  8. isValidDate(String dateString)
  9. isValidDate(String dateString)