Java Date Value Check isDate(String str)

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

Description

is Date

License

Open Source License

Declaration

public static boolean isDate(String str) 

Method Source Code


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

public class Main {
    public static boolean isDate(String str) {
        java.text.DateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        try {//from w  ww  .  j  av a  2s. c  o  m
            sdf.setLenient(false);
            sdf.parse(str);
        } catch (ParseException e) {
            return false;
        }
        return true;
    }
}

Related

  1. isDate(String input)
  2. isDate(String pattern, String text)
  3. isDate(String s)
  4. isDate(String str)
  5. IsDate(String str)
  6. isDate(String str, String format)
  7. isDate(String str, String pattern)
  8. isDate(String strDate, SimpleDateFormat sdf)
  9. isDate(String strDate, String pattern)