Java Date Value Check isDate(final String date)

Here you can find the source of isDate(final String date)

Description

Checks if is date.

License

Open Source License

Parameter

Parameter Description
date the date

Return

true, if is date

Declaration

public static boolean isDate(final String date) 

Method Source Code


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

public class Main {
    /** The Constant DATE. */
    private static final SimpleDateFormat DATE = new SimpleDateFormat("dd/MM/yyyy");

    /**// w ww . j  a  v a2 s  . c om
     * Checks if is date.
     * 
     * @param date
     *            the date
     * @return true, if is date
     */
    public static boolean isDate(final String date) {
        boolean result;
        try {
            DATE.parse(date);
            result = true;
        } catch (ParseException e) {
            result = false;
        }
        return result;
    }
}

Related

  1. isData(long date)
  2. isDataOra(String date)
  3. isDate(final String date)
  4. isDate(final String dateString)
  5. isDate(final String strDate, final String pattern)
  6. isDate(Object object)