Java Date Value Check isDateTwo(String value)

Here you can find the source of isDateTwo(String value)

Description

qli comment the method "isDateTwo".

License

Open Source License

Parameter

Parameter Description
value a parameter

Return

boolean

Declaration

private static boolean isDateTwo(String value) 

Method Source Code


//package com.java2s;
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    /**/*from ww w  . ja v a 2 s  .  co  m*/
     * 
     * qli comment the method "isDateTwo".
     * 
     * @param value
     * 
     * @return boolean
     */
    private static boolean isDateTwo(String value) {
        if (value != null) {
            try {
                String dateFormat = "yyyy-MM-dd";//$NON-NLS-1$
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat);

                Date dt = simpleDateFormat.parse(value);
                simpleDateFormat.format(dt);
                return true;
            } catch (ParseException pe) {
                return false;
            }
        } else
            return false;
    }
}

Related

  1. isDateFormatValid(final String pattern)
  2. isDateInRange(Date startDt, Date endDt, Date theDate)
  3. isDateInRange(Date toCheck, Date minRange, Date maxRange)
  4. IsDateOK(String date)
  5. isDateSortedAsc(List dates, String format)
  6. isDateValid(String date, Locale locale)
  7. isDateValid(String dateString, String validFormat)
  8. isDateValid(String dateToCheck, String pattern)
  9. isDateValid(String dateToValidate)