Java Date Value Check isDate(String input)

Here you can find the source of isDate(String input)

Description

is date

License

Open Source License

Parameter

Parameter Description
input a parameter

Return

boolean

Declaration

public static boolean isDate(String input) 

Method Source Code


//package com.java2s;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public final static String DATE_FORMAT = "dd/MM/yyyy";

    /**/*from   w ww.  j  a  v  a 2 s. c o m*/
     * is date
     *
     * @param input
     * @return boolean
     */
    public static boolean isDate(String input) {
        try {
            SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
            Date d = sdf.parse(input);
            return true;
        } catch (ParseException ex) {
            return false;
        }
    }
}

Related

  1. isDate(Object object)
  2. isDate(String date)
  3. isDate(String dateStr, String dateFormat)
  4. isDate(String dateString)
  5. isDate(String dttm, String format)
  6. isDate(String input)
  7. isDate(String pattern, String text)
  8. isDate(String s)
  9. isDate(String str)