Java SQL Date Check isDate(String val)

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

Description

is Date

License

Open Source License

Parameter

Parameter Description
val a parameter

Declaration

private static boolean isDate(String val) 

Method Source Code


//package com.java2s;
/*// ww  w  .  j a v  a 2 s  .co  m
 * @(#)SQLUtil.java $Date: Dec 16, 2011 6:28:55 PM $
 * 
 * Copyright ? 2011 FortMoon Consulting, Inc. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of FortMoon
 * Consulting, Inc. ("Confidential Information"). You shall not disclose such
 * Confidential Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with FortMoon Consulting.
 * 
 * FORTMOON MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. FORTMOON SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
 * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 * 
 */

import java.sql.Date;

public class Main {
    /**
     * @param val
     * @return
     */
    private static boolean isDate(String val) {
        try {
            Date.valueOf(val);
            return true;
        } catch (IllegalArgumentException ie) {
        }
        return false;
    }
}

Related

  1. isDate(int colType)
  2. isDate(int dataType)
  3. isDate(int dataType)
  4. isDate(Object obj)
  5. isDate(String str)
  6. isDateOneAfterDateTwo(Date dateOne, Date dateTwo)
  7. isDateType(Class targetType)
  8. isDateValue(Class inValueType)
  9. isDateValue(Object inValue)