Java Date Value Check isDate(String strDate, SimpleDateFormat sdf)

Here you can find the source of isDate(String strDate, SimpleDateFormat sdf)

Description

is Date

License

LGPL

Declaration

public static boolean isDate(String strDate, SimpleDateFormat sdf) 

Method Source Code

//package com.java2s;
/*//from w w  w. j  ava  2 s.  c o m
 * JLib - Publicitas Java library v1.2.0.
 *
 * Copyright (c) 2005, 2006, 2007, 2008, 2009 Publicitas SA.
 * Licensed under LGPL (LGPL-LICENSE.txt) license.
 */

import java.text.SimpleDateFormat;

public class Main {
    public static boolean isDate(String strDate, SimpleDateFormat sdf) {

        boolean isDate = false;

        try {

            sdf.parse(strDate);
            isDate = true;

        } catch (Exception ex) {
            isDate = false;
            //_logger.error("Util.java - Not able to convert strToDate - The given date format is incorrect", ex);
        }

        return isDate;

    }
}

Related

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